mars-v2-frontend/src/components/Modals/Account/AccountDeleteAlertDialog.tsx
2024-01-25 14:30:01 +01:00

34 lines
810 B
TypeScript

import { useEffect } from 'react'
import { Enter, InfoCircle } from 'components/common/Icons'
import useAlertDialog from 'hooks/useAlertDialog'
interface Props {
content: string | JSX.Element
title: string
icon?: JSX.Element
closeHandler: () => void
positiveButton: AlertDialogButton
}
export default function AccountDeleteAlertDialog(props: Props) {
const { open: showAlertDialog } = useAlertDialog()
const { title, content, closeHandler, positiveButton } = props
useEffect(() => {
showAlertDialog({
icon: <InfoCircle />,
title,
content,
negativeButton: {
text: 'Cancel',
icon: <Enter />,
onClick: closeHandler,
},
positiveButton,
})
}, [showAlertDialog, closeHandler, positiveButton, title, content])
return null
}