import { Button } from '@/components/ui/button'; import { Dialog, DialogContent, DialogTrigger } from '@/components/ui/dialog'; import { cn } from '@/lib/utils'; import { SharedData } from '@/types/global'; import { router, usePage } from '@inertiajs/react'; import { useState } from 'react'; interface Props { message?: string; routePath: string; actionComponent: React.ReactNode; } const DeleteModal = (props: Props) => { const page = usePage(); const { button, frontend } = page.props.translate; const { message, routePath, actionComponent } = props; const [modal, setModal] = useState(false); const handleOpen = () => { setModal((prev) => !prev); }; const deleteHandler = () => { router.delete(routePath, { preserveScroll: true, onSuccess: () => { setModal(false); }, }); }; return ( {actionComponent}
{frontend.delete_warning}
{message && (

{message}

)}
); }; export default DeleteModal;