Skip to content

Commit

Permalink
feature(edit/actions): add alert-dialog to deny-action
Browse files Browse the repository at this point in the history
  • Loading branch information
olexh committed May 7, 2024
1 parent 322fb43 commit 0a993e9
Showing 1 changed file with 34 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ import { useParams } from 'next/navigation';

import { useMutation, useQueryClient } from '@tanstack/react-query';

import {
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
AlertDialogTrigger,
} from '@/components/ui/alert-dialog';
import { Button } from '@/components/ui/button';
import denyEdit from '@/services/api/edit/denyEdit';

Expand Down Expand Up @@ -34,14 +44,30 @@ const DenyAction: FC<Props> = () => {
};

return (
<Button
variant="destructive"
size="sm"
disabled={mutation.isPending}
onClick={handleClick}
>
Відхилити
</Button>
<AlertDialog>
<AlertDialogTrigger asChild>
<Button
variant="destructive"
size="sm"
disabled={mutation.isPending}
>
Відхилити
</Button>
</AlertDialogTrigger>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>
Ви впевнені, що хочете відхилити правку?
</AlertDialogTitle>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>Відмінити</AlertDialogCancel>
<AlertDialogAction onClick={handleClick}>
Підтвердити
</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
);
};

Expand Down

0 comments on commit 0a993e9

Please sign in to comment.