import React, { Fragment } from 'react'; import { Dialog as HeadlessDialog, Transition } from '@headlessui/react'; import { Button } from '@/components/elements/button/index'; import styles from './dialog.module.css'; import { XIcon } from '@heroicons/react/solid'; import { CheckIcon, ExclamationIcon, InformationCircleIcon, ShieldExclamationIcon } from '@heroicons/react/outline'; import classNames from 'classnames'; interface Props { visible: boolean; onDismissed: () => void; title?: string; children?: React.ReactNode; } interface DialogIconProps { type: 'danger' | 'info' | 'success' | 'warning'; className?: string; } const DialogIcon = ({ type, className }: DialogIconProps) => { const [ Component, styles ] = (function (): [(props: React.ComponentProps<'svg'>) => JSX.Element, string] { switch (type) { case 'danger': return [ ShieldExclamationIcon, 'bg-red-500 text-red-50' ]; case 'warning': return [ ExclamationIcon, 'bg-yellow-600 text-yellow-50' ]; case 'success': return [ CheckIcon, 'bg-green-600 text-green-50' ]; case 'info': return [ InformationCircleIcon, 'bg-primary-500 text-primary-50' ]; } })(); return (