import { Dialog as MuiDialog, DialogProps, PaperProps, Paper, Box, IconButton, Stack, useMediaQuery, Theme, } from '@mui/material'; import CloseIcon from '@mui/icons-material/Close'; import styled from '@mui/material/styles/styled'; import PoweredByRipcordIcon from '../icons/PoweredByRipcordIcon'; const StyledContent = styled(Box)(({ theme }) => ({ display: 'grid', gridTemplateRows: '48px 1fr 48px', overflow: 'hidden', height: '100%', })); export default function Dialog({ open, onClose, children, slots, enableConfirmedDesign = false, ...rest }: { open: boolean; onClose: () => void; slots?: { headerLeft?: React.ReactNode; footerLeft?: React.ReactNode; }; children?: React.ReactNode; enableConfirmedDesign?: boolean; } & DialogProps) { const isMobile = useMediaQuery((theme) => theme.breakpoints.down('md')); return ( ({ '& .MuiDialog-paper': { m: 0, transition: theme.transitions.create(['max-width', 'background-color'], { easing: theme.transitions.easing.easeInOut, duration: theme.transitions.duration.standard, }), ...(enableConfirmedDesign ? { bgcolor: theme.palette.mode === 'light' ? theme.palette.grey[200] : theme.palette.grey[800], } : { overflow: 'hidden', }), }, })} {...rest} > ({ px: { xs: 3, md: 4, }, ...(!enableConfirmedDesign && { borderBottom: `1px solid ${theme.palette.divider}`, }), })} > {slots?.headerLeft} {children} ({ px: { xs: 3, md: 4, }, ...(!enableConfirmedDesign && { borderTop: `1px solid ${theme.palette.divider}`, }), bgcolor: theme.palette.mode === 'light' ? theme.palette.grey[200] : theme.palette.grey[800], })} > {slots?.footerLeft} ({ ml: 'auto', display: 'flex', alignItems: 'center', fill: theme.palette.text.secondary, '& svg': { height: 20, }, })} /> ); } export function DialogInline({ children, slots, enableConfirmedDesign = false, sx, ...rest }: { slots?: { headerLeft?: React.ReactNode; footerLeft?: React.ReactNode; }; children?: React.ReactNode; enableConfirmedDesign?: boolean; } & PaperProps) { return ( theme.transitions.create(['max-width', 'background-color'], { easing: theme.transitions.easing.easeInOut, duration: theme.transitions.duration.standard, }), ...(enableConfirmedDesign ? { bgcolor: (theme) => theme.palette.mode === 'light' ? theme.palette.grey[200] : theme.palette.grey[800], } : { overflow: 'hidden', }), width: '100%', ...sx, }} {...rest} > ({ px: { xs: 3, md: 4, }, ...(!enableConfirmedDesign && { borderBottom: `1px solid ${theme.palette.divider}`, }), })} > {slots?.headerLeft} {children} ({ px: { xs: 3, md: 4, }, ...(!enableConfirmedDesign && { borderTop: `1px solid ${theme.palette.divider}`, }), bgcolor: theme.palette.mode === 'light' ? theme.palette.grey[200] : theme.palette.grey[800], })} > {slots?.footerLeft} ({ ml: 'auto', display: 'flex', alignItems: 'center', fill: theme.palette.text.secondary, '& svg': { height: 20, }, })} /> ); }