-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
-Add Notification when user add to cart -Add loading stage when loading from local storage
- Loading branch information
1 parent
39536c8
commit 39eb3d2
Showing
7 changed files
with
84 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 ( | ||
<div className="animate-notification absolute w-1/4 h-[80px] translate-y-[-30vh] flex items-center justify-center flex-col bg-ACMDARK text-white rounded-lg"> | ||
<div className="w-11/12 text-xl font-semibold"> | ||
<h1 className="cursor-pointer" onClick={() => setShowNotification(false)}>X</h1> | ||
</div> | ||
<h1 className="text-lg font-semibold mb-2">Product Add to the cart effectively</h1> | ||
<div className="w-[95%] h-10 bg-black mb-2 "> | ||
<div | ||
className={`h-full bg-white `} | ||
style={{ width: `${progress}%` }} | ||
/> | ||
</div> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters