import React from 'react';
import { Modal as MuiModal, Paper, Box, Typography } from '@mui/material';
import { ModalBaseProps } from '../interfaces';
import styled from 'styled-components';
import { IconButton } from './IconButton';
import { Button } from './Button';
const ModalStyled = styled(MuiModal)({});
const ModalContentStyled = styled(Paper) <{ $w?: string }>`
border: 1px solid #00000033;
border-radius: 4px;
position: absolute;
top: 50%;
left: 50%;
width: ${props => props.$w || '421px'};
transform: translate(-50%, -50%);
background-color: #fff;
outline: none;
`;
const ModalHeaderStyled = styled(Box)`
text-align: left;
box-sizing: border-box;
margin: 0;
position: relative;
padding: 22px 26px 15px 26px;
pointer-events: none;
& h2 {
font-style: normal;
font-weight: 600;
font-size: 18px;
color: #1d1d1d;
}
& p{
margin-top: 16px;
}
`;
const ModalFooterStyled = styled(Box) <{ $spaceBetween?: boolean }>`
box-sizing: border-box;
position: relative;
padding: 24px;
display: flex;
justify-content: ${props => (props.$spaceBetween ? 'space-between' : 'flex-end')};
gap: 24px;
`;
const ModalContainerChildrenStyled = styled(Box)`
box-sizing: border-box;
padding: 24px;
`;
export function Close() {
return (
);
}
export const Modal = ({ open, children, paperProps, ...props }: ModalBaseProps) => {
const handleClose = (event: {}, reason: "backdropClick" | "escapeKeyDown") => {
(reason === "escapeKeyDown" || !props.shouldNotCloseOnOutsideClick) && props.onClose?.(event as React.SyntheticEvent);
};
return (
{props.title && (
{props.title}
{props.description && {props.description}}
)}
{children}
{!!props.action?.length && (
{props.action.map(({ color, variant, action, size, label, ...rest }, key) => (
))}
)}
);
};