From b7c4b528ec56bddb632794dddb48462dcdf5b16a Mon Sep 17 00:00:00 2001 From: Juthatip McDevitt Date: Fri, 19 Apr 2024 16:35:03 -0500 Subject: [PATCH] updated add to bag functionality --- awwwards_ss4/src/components/Home.jsx | 40 +++++++++++++++-- awwwards_ss4/src/components/NavBag.jsx | 57 ++++++++++++++++++++++++ awwwards_ss4/src/components/Navbar.jsx | 2 +- awwwards_ss4/src/components/Products.jsx | 2 +- 4 files changed, 95 insertions(+), 6 deletions(-) create mode 100644 awwwards_ss4/src/components/NavBag.jsx diff --git a/awwwards_ss4/src/components/Home.jsx b/awwwards_ss4/src/components/Home.jsx index ef05895..a02c9cc 100644 --- a/awwwards_ss4/src/components/Home.jsx +++ b/awwwards_ss4/src/components/Home.jsx @@ -2,12 +2,15 @@ import Navbar from "./Navbar"; import Slider from "react-slick"; import "slick-carousel/slick/slick.css"; import "slick-carousel/slick/slick-theme.css"; -import {motion} from "framer-motion" +import {motion, AnimatePresence} from "framer-motion" import { AiOutlineShopping, AiOutlineSearch } from "react-icons/ai"; import { RiMenu2Fill } from "react-icons/ri"; +import { IoClose } from "react-icons/io5"; import Img1 from "../assets/bg-1.webp" import Img2 from "../assets/bg-2.webp" import Img3 from "../assets/bg-3.webp" +import { useState } from "react"; +import NavBag from "./NavBag"; const Home = () => { @@ -25,6 +28,23 @@ const Home = () => { initial:{x: 0,}, animate:{x: "-100%", transition:{ease: "linear", repeat: Infinity, duration: 20},}, }; +//NavClick + const [isActive, setIsActive] = useState(false); + const [isActiveBag, setIsActiveBag] = useState(false); + const [isActiveSearch, setIsActiveSearch] = useState(false); + const opacity = { + initial: { + opacity: 0 + }, + open: { + opacity: 1, + transition: {duration: 0.35} + }, + closed: { + opacity: 0, + transition: {duration: 0.35} + } + } return ( <> @@ -39,10 +59,22 @@ const Home = () => {
-

-

-

+
{setIsActiveBag(!isActiveBag)}} className="relative bg-[#FBF8F4] w-10 h-10 rounded-full mb-5 flex justify-center items-center cursor-pointer"> + + +
+
{setIsActiveSearch(!isActiveSearch)}} className="relative bg-[#FBF8F4] w-10 h-10 rounded-full mb-5 flex justify-center items-center cursor-pointer"> + + +
+
{setIsActive(!isActive)}} className="icon-hidden relative bg-[#FBF8F4] w-10 h-10 rounded-full mb-5 flex justify-center items-center cursor-pointer"> + + +
+ + {isActiveBag && } +
diff --git a/awwwards_ss4/src/components/NavBag.jsx b/awwwards_ss4/src/components/NavBag.jsx new file mode 100644 index 0000000..58aa37c --- /dev/null +++ b/awwwards_ss4/src/components/NavBag.jsx @@ -0,0 +1,57 @@ +const NavBag = () => { + return ( +
+
+
+

my bag (0)

+
+

Spend another $50 to recieve FREE SHIPPING

+
+

No items in your bag

+
+
+

Build your kit

+ +
+ + +
+ + +
+
+

Subtotal:

+

$0

+
+ +
+
+
+ ) +} + +export default NavBag \ No newline at end of file diff --git a/awwwards_ss4/src/components/Navbar.jsx b/awwwards_ss4/src/components/Navbar.jsx index fbdef3d..9bb5f6d 100644 --- a/awwwards_ss4/src/components/Navbar.jsx +++ b/awwwards_ss4/src/components/Navbar.jsx @@ -1,6 +1,6 @@ const Navbar = () => { return ( -
+
shop ethos diff --git a/awwwards_ss4/src/components/Products.jsx b/awwwards_ss4/src/components/Products.jsx index 281b78c..4c781df 100644 --- a/awwwards_ss4/src/components/Products.jsx +++ b/awwwards_ss4/src/components/Products.jsx @@ -99,7 +99,7 @@ const Products = () => { - +