mirror of
https://github.com/utopia-os/utopia-ui.git
synced 2026-01-20 20:01:18 +00:00
42 lines
1.0 KiB
TypeScript
42 lines
1.0 KiB
TypeScript
import DialogModal from '#components/Templates/DialogModal'
|
|
|
|
import type { Item } from '#types/Item'
|
|
|
|
interface DeleteModalProps {
|
|
item: Item
|
|
isOpen: boolean
|
|
onClose: () => void
|
|
onConfirm: (e: React.MouseEvent) => void
|
|
}
|
|
|
|
export function DeleteModal({ item, isOpen, onClose, onConfirm }: DeleteModalProps) {
|
|
const handleConfirm = (e: React.MouseEvent) => {
|
|
onConfirm(e)
|
|
onClose()
|
|
}
|
|
|
|
return (
|
|
<DialogModal isOpened={isOpen} title='Are you sure?' showCloseButton={false} onClose={onClose}>
|
|
<div
|
|
onClick={(e) => {
|
|
e.stopPropagation()
|
|
}}
|
|
>
|
|
<span>
|
|
Do you want to delete <b>{item.name}</b>?
|
|
</span>
|
|
<div className='tw:grid'>
|
|
<div className='tw:flex tw:justify-between'>
|
|
<label className='tw:btn tw:mt-4 tw:btn-error' onClick={handleConfirm}>
|
|
Yes
|
|
</label>
|
|
<label className='tw:btn tw:mt-4' onClick={onClose}>
|
|
No
|
|
</label>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</DialogModal>
|
|
)
|
|
}
|