"use client"; import React from "react"; import { backdropAnimationVariants, contentAnimationVariants, sizeToPixel, } from "./constants"; import { ModalProps } from "./types"; import { motion } from "framer-motion"; import * as Dialog from "@radix-ui/react-dialog"; import { MaterialIcon } from "@shared/components/material-icon"; import { Text } from "@shared/components/text"; import { Button } from "@shared/contentful/blocks/button"; import { cx } from "@shared/utils"; type ExtendedModalProps = ModalProps & { type?: string; index?: number; }; export const Modal: React.FC = props => { const { isOpen, onRequestClose, size, title, content, description, children, bodyClassName, type = "modal", index = 0, } = props; return ( isOpen && onRequestClose?.()} >
e.preventDefault()} className={cx( "relative mx-auto w-full rounded-modal bg-bg p-[25px] shadow-drop focus:outline-none", bodyClassName )} style={{ maxWidth: sizeToPixel[size || "lg"] }} >
{title ? ( {title} ) : null} {description ? ( {description} ) : null}
{content} {children ? children : null}
); };