import React, { FC, memo } from 'react'; import { CSSTransition } from 'react-transition-group'; import { cn } from '../../util/bem'; import { usePortal } from '../portal/portal.hook'; import './modal.component.scss'; export type ModalPropsType = { children?: React.ReactNode; backDrop?: boolean; backDropTransparent?: boolean; position?: 'center' | 'top' | 'bottom-right'; size?: 'xs' | 'lg' | 'xl'; style?: React.CSSProperties; actions?: React.ReactNode; onHideModal?: React.EventHandler>; // onClick?: React.EventHandler>; className?: string; in?: boolean; } const className = cn('modal'); export const Modal: FC = memo((props) => { const { Portal } = usePortal(); return (
{ event.stopPropagation(); } } > { props.backDrop && (
) }
{ props.children }
); }); Modal.defaultProps = { in: true, backDrop: true, position: 'center' };