Spaces:
Sleeping
Sleeping
| "use client"; | |
| import { | |
| Dialog, | |
| DialogContent, | |
| DialogDescription, | |
| DialogFooter, | |
| DialogHeader, | |
| DialogTitle, | |
| } from "@/components/ui/dialog"; | |
| import { Button } from "@/components/ui/button"; | |
| type Props = { | |
| open: boolean; | |
| onOpenChange: (open: boolean) => void; | |
| title: string; | |
| description: string; | |
| onConfirm: () => void; | |
| destructive?: boolean; | |
| }; | |
| export function ConfirmDialog({ | |
| open, | |
| onOpenChange, | |
| title, | |
| description, | |
| onConfirm, | |
| destructive, | |
| }: Props) { | |
| return ( | |
| <Dialog open={open} onOpenChange={onOpenChange}> | |
| <DialogContent> | |
| <DialogHeader> | |
| <DialogTitle>{title}</DialogTitle> | |
| <DialogDescription>{description}</DialogDescription> | |
| </DialogHeader> | |
| <DialogFooter> | |
| <Button variant="outline" onClick={() => onOpenChange(false)}> | |
| Cancel | |
| </Button> | |
| <Button | |
| variant={destructive ? "destructive" : "default"} | |
| onClick={() => { | |
| onConfirm(); | |
| onOpenChange(false); | |
| }} | |
| > | |
| Confirm | |
| </Button> | |
| </DialogFooter> | |
| </DialogContent> | |
| </Dialog> | |
| ); | |
| } | |