Skip to content

Commit

Permalink
Better state naming for Modal component
Browse files Browse the repository at this point in the history
Co-authored-by: Maxime Bouveron <[email protected]>
  • Loading branch information
dtrucs and Bo-Duke committed Jun 20, 2024
1 parent 39e2b02 commit fa9e7f4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions frontend/src/components/Modal/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,24 @@ export const Modal: React.FC<Props> = ({ className, children }) => {
const intl = useIntl();

const ref = useRef(null);
const [show, toggle] = useState(false);
const isFullscreen = useFullscreen(ref, show, { onClose: () => toggle(false) });
const [show, setShow] = useState(false);
const isFullscreen = useFullscreen(ref, show, { onClose: () => setShow(false) });

return (
<div ref={ref} className={cn('relative bg-dark', className)}>
{isFullscreen && (
<MapButton
aria-label={intl.formatMessage({ id: 'details.closeFullScreen' })}
icon={<ArrowLeft size={24} />}
onClick={() => toggle(boolean => !boolean)}
onClick={() => setShow(boolean => !boolean)}
/>
)}
<div className="flex items-center justify-center size-full">
<div className="size-full">
{typeof children === 'function'
? children({
isFullscreen: show,
toggleFullscreen: () => toggle(boolean => !boolean),
toggleFullscreen: () => setShow(boolean => !boolean),
})
: children}
</div>
Expand Down

0 comments on commit fa9e7f4

Please sign in to comment.