diff options
Diffstat (limited to 'src/components/atoms/modal/modal.tsx')
| -rw-r--r-- | src/components/atoms/modal/modal.tsx | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/src/components/atoms/modal/modal.tsx b/src/components/atoms/modal/modal.tsx deleted file mode 100644 index 6f5506f..0000000 --- a/src/components/atoms/modal/modal.tsx +++ /dev/null @@ -1,49 +0,0 @@ -import { - type ForwardRefRenderFunction, - type HTMLAttributes, - type ReactElement, - type ReactNode, - forwardRef, -} from 'react'; -import type { HeadingProps } from '../heading'; -import styles from './modal.module.scss'; - -export type ModalProps = HTMLAttributes<HTMLDivElement> & { - /** - * The modal body. - */ - children: ReactNode; - /** - * The modal title. - */ - heading?: ReactElement<HeadingProps>; - /** - * The modal kind. - * - * @default 'primary' - */ - kind?: 'primary' | 'secondary'; -}; - -const ModalWithRef: ForwardRefRenderFunction<HTMLDivElement, ModalProps> = ( - { children, className = '', heading, kind = 'primary', ...props }, - ref -) => { - const headingModifier = heading ? 'modal--has-title' : ''; - const kindModifier = `modal--${kind}`; - const modalClass = `${styles.modal} ${styles[headingModifier]} ${styles[kindModifier]} ${className}`; - - return ( - <div {...props} className={modalClass} ref={ref}> - {heading ? <div className={styles.title}>{heading}</div> : null} - {children} - </div> - ); -}; - -/** - * Modal component - * - * Render a modal component. - */ -export const Modal = forwardRef(ModalWithRef); |
