import React from 'react' import { Drawer, DrawerContent, DrawerHeader, DrawerTitle, DrawerDescription, DrawerBody, DrawerFooter, DrawerClose, DrawerOverlay, DrawerPortal, } from '../Drawer' import { X } from 'lucide-react' import Block from '../Primitives/Block/Block' import { ButtonSubType, ButtonType, Button } from '../Button' import type { ModalProps } from './types' import { FOUNDATION_THEME } from '../../tokens' import { type SkeletonVariant } from '../Skeleton' import { useResponsiveTokens } from '../../hooks/useResponsiveTokens' import type { ModalTokensType } from './modal.tokens' import ModalSkeleton from './ModalSkeleton' type MobileModalProps = ModalProps & { useDrawerOnMobile?: boolean } const MobileModal: React.FC = ({ isOpen, onClose, title, subtitle, children, primaryAction, secondaryAction, showCloseButton = true, closeOnBackdropClick = true, headerRightSlot, skeleton, }) => { const modalTokens = useResponsiveTokens('MODAL') const shouldShowSkeleton = skeleton?.show const skeletonVariant: SkeletonVariant = (skeleton?.variant as SkeletonVariant) || 'pulse' const bodySkeletonWidth = skeleton?.bodySkeletonProps?.width || '100%' const bodySkeletonHeight = skeleton?.bodySkeletonProps?.height || 200 return ( { if (!open) { onClose() } }} direction="bottom" modal={true} dismissible={closeOnBackdropClick} > {(title || subtitle || shouldShowSkeleton) && ( {shouldShowSkeleton ? ( ) : ( {title && ( {title} )} {headerRightSlot} {subtitle && ( {subtitle} )} {showCloseButton && (