import { FunctionComponent } from 'react'; import * as Dialog from '@radix-ui/react-dialog'; import { XMarkSvg } from '../../atoms/icons'; import { IModalProps } from './interfaces'; import { ctw } from '../../../utils/ctw/ctw'; import { MotionScrollArea } from '../../molecules/MotionScrollArea/MotionScrollArea'; /** * * @description Wraps {@link https://www.radix-ui.com/|Radix UI}'s {@link https://www.radix-ui.com/docs/primitives/components/dialog|Dialog} component with default styling. Modal state is passed in to allow global modals and passing the state through context. * * @param props * @param props.children - The content to display within the {@link Dialog.Content} component. * @param props.isOpen - Whether the modal is open or not. * @param props.onIsOpenChange - Callback to toggle isOpen, expects a function that takes the next state as an argument. * @param props.title - Title of the modal. * @param props.hideTitle - When true makes the title of the modal be visible only to screen readers. * * @see {@link https://www.radix-ui.com/docs/primitives/components/dialog|Radix UI Dialog documentation} * * @constructor */ export const Modal: FunctionComponent = ({ children, className, isOpen, onIsOpenChange, title, hideTitle, ...props }) => { return (
{title} {/* Prevents CLS of the close button when the overflow of the content changes. */} {children}
); };