import { DialogContent, DialogOverlay } from '@reach/dialog'; import clsx from 'clsx'; import { createContext, PropsWithChildren, useContext } from 'react'; import { CloseButton } from './CloseButton'; import styles from './Modal.module.css'; const Context = createContext(null); Context.displayName = 'ModalContext'; export function useModalContext() { const context = useContext(Context); if (!context) { throw new Error('should be nested under Modal'); } return context; } interface Props { onDismiss?(): void; 'aria-label'?: string; 'aria-labelledby'?: string; size?: 'md' | 'lg'; className?: string; } export function Modal({ children, onDismiss, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, size = 'md', className, }: PropsWithChildren) { return (
{children} {onDismiss && }
); }