import { FunctionComponent } from 'preact'; import { AlertDialog, AlertDialogDescription, AlertDialogLabel, } from '@node_modules/@reach/alert-dialog'; import { useRef } from '@node_modules/preact/hooks'; export const ModalDialog: FunctionComponent = ({ children }) => { const ldRef = useRef(null); return ( {/* sn-component is focusable by default, but doesn't stretch to child width resulting in a badly focused dialog. Utility classes are not available at the sn-component level, only below it. tabIndex -1 disables focus and enables it on the child component */}
{children}
); }; export const ModalDialogLabel: FunctionComponent<{ closeDialog: () => void; className?: string; }> = ({ children, closeDialog, className }) => (
{children}
Close

); export const ModalDialogDescription: FunctionComponent<{ className?: string }> = ({ children, className = '' }) => ( {children} ); export const ModalDialogButtons: FunctionComponent<{ className?: string }> = ({ children, className, }) => ( <>
{children != undefined && Array.isArray(children) ? children.map((child, idx, arr) => ( <> {child} {idx < arr.length - 1 ?
: undefined} )) : children}
); export default ModalDialog;