${price}
removeAll(id)} onMouseLeave={(e) => handleLeave(e)} onMouseEnter={(e) => handleEnter(e)} className="text-2xl duration-200 transition-all ease-in cursor-pointer">X
diff --git a/app/components/notification.jsx b/app/components/notification.jsx
new file mode 100644
index 0000000..11ae289
--- /dev/null
+++ b/app/components/notification.jsx
@@ -0,0 +1,33 @@
+import React, { useState, useEffect } from "react";
+
+export default function Notification({ setShowNotification }) {
+ const [progress, setProgress] = useState(100);
+
+ useEffect(() => {
+ const interval = setInterval(() => {
+ setProgress((prevProgress) => (prevProgress - 1));
+ }, 60);
+
+ }, []);
+
+ useEffect(() => {
+ if (progress <= 0) {
+ setShowNotification(false);
+ }
+ }, [progress, setShowNotification]);
+
+ return (
+
+
+
setShowNotification(false)}>X
+
+
Product Add to the cart effectively
+
+
+ );
+}
diff --git a/app/products/[id]/page.jsx b/app/products/[id]/page.jsx
index 2179b4d..c4a11d7 100644
--- a/app/products/[id]/page.jsx
+++ b/app/products/[id]/page.jsx
@@ -4,11 +4,13 @@ import { useTheme } from "../../Domain/ThemeContext";
import { useProducts } from "@/app/Domain/ProductContext";
import Image from "next/image";
import ProductDescription from "@/app/components/ProductDescription";
+import Notification from "@/app/components/notification";
export default function product({ params }) {
const { isDarkMode } = useTheme();
const { products, getURL } = useProducts();
const [product, setProduct] = useState({})
+ const [showNotification,setShowNotification] = useState(false)
useEffect(() => {
@@ -22,9 +24,10 @@ export default function product({ params }) {
return (
<>
diff --git a/tailwind.config.js b/tailwind.config.js
index ae554f6..58db678 100644
--- a/tailwind.config.js
+++ b/tailwind.config.js
@@ -29,9 +29,14 @@ module.exports = {
typewriter: 'typewriter 2s steps(44) 1s 1 normal both, blinkTextCursor 500ms steps(44) 5 normal',
dropTop: 'dropTop 0.2s ease-in',
slideIn: 'slideIn 0.3s ease-out',
- loading: 'loading 2s infinite ease-in-out'
+ loading: 'loading 2s infinite ease-in-out',
+ notification:'notification 0.3s ease-out'
},
keyframes:{
+ notification:{
+ '0%':{transform:'translateY(-120vh)',opacity:'0'},
+ '100%':{transform:'translateY(-30vh)',opacity:'1'}
+ },
dropTop:{
'0%': {transform: 'translate(50%,50%)', opacity:'0',scale:'0.5' },
'100%': {transform:'translate(0%,0%)',opacity:'1',scale:'1'}