2025-02-10 16:49:47 +11:00
|
|
|
import React, { ReactNode } from 'react';
|
|
|
|
|
import FocusTrap from 'focus-trap-react';
|
|
|
|
|
import { Modal, Overlay, OverlayBackdrop, OverlayCenter } from 'folds';
|
|
|
|
|
import { stopPropagation } from '../utils/keyboard';
|
2026-06-18 18:11:24 -04:00
|
|
|
import { useModalStyle } from '../hooks/useModalStyle';
|
2025-02-10 16:49:47 +11:00
|
|
|
|
|
|
|
|
type Modal500Props = {
|
|
|
|
|
requestClose: () => void;
|
|
|
|
|
children: ReactNode;
|
|
|
|
|
};
|
|
|
|
|
export function Modal500({ requestClose, children }: Modal500Props) {
|
2026-06-18 18:11:24 -04:00
|
|
|
const modalStyle = useModalStyle(560);
|
2025-02-10 16:49:47 +11:00
|
|
|
return (
|
|
|
|
|
<Overlay open backdrop={<OverlayBackdrop />}>
|
|
|
|
|
<OverlayCenter>
|
|
|
|
|
<FocusTrap
|
|
|
|
|
focusTrapOptions={{
|
|
|
|
|
initialFocus: false,
|
|
|
|
|
clickOutsideDeactivates: true,
|
|
|
|
|
onDeactivate: requestClose,
|
|
|
|
|
escapeDeactivates: stopPropagation,
|
|
|
|
|
}}
|
|
|
|
|
>
|
2026-06-18 18:11:24 -04:00
|
|
|
<Modal size="500" variant="Background" style={modalStyle}>
|
2025-02-10 16:49:47 +11:00
|
|
|
{children}
|
|
|
|
|
</Modal>
|
|
|
|
|
</FocusTrap>
|
|
|
|
|
</OverlayCenter>
|
|
|
|
|
</Overlay>
|
|
|
|
|
);
|
|
|
|
|
}
|