diff --git a/package-lock.json b/package-lock.json
index 7aa87d0b..92aca9f1 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -10,6 +10,7 @@
"dependencies": {
"@hookform/resolvers": "^3.3.4",
"@radix-ui/react-accordion": "^1.1.2",
+ "@radix-ui/react-alert-dialog": "^1.0.5",
"@radix-ui/react-checkbox": "^1.0.4",
"@radix-ui/react-dialog": "^1.0.5",
"@radix-ui/react-label": "^2.0.2",
@@ -1382,6 +1383,35 @@
}
}
},
+ "node_modules/@radix-ui/react-alert-dialog": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/@radix-ui/react-alert-dialog/-/react-alert-dialog-1.0.5.tgz",
+ "integrity": "sha512-OrVIOcZL0tl6xibeuGt5/+UxoT2N27KCFOPjFyfXMnchxSHZ/OW7cCX2nGlIYJrbHK/fczPcFzAwvNBB6XBNMA==",
+ "license": "MIT",
+ "dependencies": {
+ "@babel/runtime": "^7.13.10",
+ "@radix-ui/primitive": "1.0.1",
+ "@radix-ui/react-compose-refs": "1.0.1",
+ "@radix-ui/react-context": "1.0.1",
+ "@radix-ui/react-dialog": "1.0.5",
+ "@radix-ui/react-primitive": "1.0.3",
+ "@radix-ui/react-slot": "1.0.2"
+ },
+ "peerDependencies": {
+ "@types/react": "*",
+ "@types/react-dom": "*",
+ "react": "^16.8 || ^17.0 || ^18.0",
+ "react-dom": "^16.8 || ^17.0 || ^18.0"
+ },
+ "peerDependenciesMeta": {
+ "@types/react": {
+ "optional": true
+ },
+ "@types/react-dom": {
+ "optional": true
+ }
+ }
+ },
"node_modules/@radix-ui/react-arrow": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/@radix-ui/react-arrow/-/react-arrow-1.0.3.tgz",
diff --git a/package.json b/package.json
index 62a1de6d..a5bac521 100644
--- a/package.json
+++ b/package.json
@@ -12,6 +12,7 @@
"dependencies": {
"@hookform/resolvers": "^3.3.4",
"@radix-ui/react-accordion": "^1.1.2",
+ "@radix-ui/react-alert-dialog": "^1.0.5",
"@radix-ui/react-checkbox": "^1.0.4",
"@radix-ui/react-dialog": "^1.0.5",
"@radix-ui/react-label": "^2.0.2",
diff --git a/src/components/ConfirmDialog/ConfirmDialog.tsx b/src/components/ConfirmDialog/ConfirmDialog.tsx
new file mode 100644
index 00000000..f6f48075
--- /dev/null
+++ b/src/components/ConfirmDialog/ConfirmDialog.tsx
@@ -0,0 +1,36 @@
+import {
+ AlertDialog,
+ AlertDialogAction,
+ AlertDialogCancel,
+ AlertDialogContent,
+ AlertDialogDescription,
+ AlertDialogFooter,
+ AlertDialogHeader,
+ AlertDialogTitle,
+ AlertDialogTrigger,
+} from "@/components/ui/alert-dialog";
+import { Button } from "@/components/ui/button";
+import { IConfirmDialog } from "./type";
+
+export function ConfirmDialog(props: IConfirmDialog) {
+ const red: string = "rgb(220 38 38)"
+ return (
+
+
+
+
+
+
+ {props.title}
+
+ {props.description}
+
+
+
+ {props.labelOnConfirm}
+ {props.labelOnCancel}
+
+
+
+ )
+}
diff --git a/src/components/ConfirmDialog/index.ts b/src/components/ConfirmDialog/index.ts
new file mode 100644
index 00000000..edd30bf2
--- /dev/null
+++ b/src/components/ConfirmDialog/index.ts
@@ -0,0 +1,3 @@
+import { ConfirmDialog } from "./ConfirmDialog";
+
+export { ConfirmDialog };
\ No newline at end of file
diff --git a/src/components/ConfirmDialog/type.ts b/src/components/ConfirmDialog/type.ts
new file mode 100644
index 00000000..182791b5
--- /dev/null
+++ b/src/components/ConfirmDialog/type.ts
@@ -0,0 +1,9 @@
+export interface IConfirmDialog {
+ variant: any
+ label: string
+ title: string
+ description: string
+ labelOnConfirm: string
+ labelOnCancel: string
+ onClickConfirm: (() => void) | undefined
+}
\ No newline at end of file
diff --git a/src/components/DonationCart/components/DonationCartForm/DonationCartForm.tsx b/src/components/DonationCart/components/DonationCartForm/DonationCartForm.tsx
index 98b90f80..1319082c 100644
--- a/src/components/DonationCart/components/DonationCartForm/DonationCartForm.tsx
+++ b/src/components/DonationCart/components/DonationCartForm/DonationCartForm.tsx
@@ -24,6 +24,8 @@ import { IDonateItem } from '@/service/donationOrder/types';
import { TextField } from '../../../TextField';
import { ICreateUser } from '@/service/users/types';
import { IDonationCartForm } from './types';
+import { ConfirmDialog } from '@/components/ConfirmDialog/ConfirmDialog';
+import { toast } from '@/components/ui/use-toast';
const DonationCartForm = React.forwardRef(
(props, ref) => {
@@ -39,6 +41,9 @@ const DonationCartForm = React.forwardRef(
const handleCancelCart = useCallback(() => {
clearCart(shelterId);
if (onCancel) onCancel();
+ toast({
+ title: 'Doação cancelada com sucesso',
+ });
}, [clearCart, onCancel, shelterId]);
const handleChangeQuantity = useCallback(
@@ -251,9 +256,15 @@ const DonationCartForm = React.forwardRef(
-
+
+