import * as RadixDialog from '@radix-ui/react-dialog'; import DangerIcon from '../../assets/icons/dialog/danger.svg'; import InfoIcon from '../../assets/icons/dialog/info.svg'; import SuccessIcon from '../../assets/icons/dialog/success.svg'; import WarningIcon from '../../assets/icons/dialog/warning.svg'; import { Colors } from '../../hooks/theme'; import { Button } from '../Button'; import { Flex } from '../Flex'; import { Heading } from '../Heading'; import { Text } from '../Text'; import { Overlay, Content } from './styles'; type Type = 'info' | 'success' | 'warning' | 'danger'; type DialogProps = { isOpen: boolean; onRequestClose: () => void; title: string; description: string; type: Type; submitText: string; onSubmit: () => void; cancelText?: string; }; export function Dialog({ isOpen, onRequestClose, title, description, type, submitText, onSubmit, cancelText = 'Cancel', }: DialogProps): JSX.Element { function buttonColorScheme(): Colors { if (type === 'success') { return 'green'; } if (type === 'warning') { return 'amber'; } if (type === 'danger') { return 'red'; } return 'blue'; } return ( {type === 'info' && ( )} {type === 'success' && ( )} {type === 'warning' && ( )} {type === 'danger' && ( )} {title} {description} ); }