From 732ab51970793e2875efb911f0f89e67791a3a30 Mon Sep 17 00:00:00 2001 From: nabin Date: Sat, 9 Mar 2024 20:51:43 +0545 Subject: [PATCH 1/5] logo component added --- src/Components/Header.jsx | 34 +++++++++++++++++----------------- src/Components/Logo.jsx | 14 ++++++++++++++ 2 files changed, 31 insertions(+), 17 deletions(-) create mode 100644 src/Components/Logo.jsx diff --git a/src/Components/Header.jsx b/src/Components/Header.jsx index 9cff31e..4da9256 100644 --- a/src/Components/Header.jsx +++ b/src/Components/Header.jsx @@ -1,9 +1,10 @@ import { GiHamburgerMenu } from "react-icons/gi"; -import { FaCartPlus } from "react-icons/fa"; -import { FaUserCircle } from "react-icons/fa"; import { RxCross1 } from "react-icons/rx"; import { useState } from "react"; import clsx from "clsx"; +import LeftContainer from "./LeftContainer"; +import Logo from "./Logo"; + const Header = () => { const [state, setState] = useState(false); @@ -25,19 +26,21 @@ const Header = () => { }} className="text-2xl lg:hidden" /> -

logo

+ + +
-
    - {list.map((elem, i) => { - const { title } = elem; //destructed in react // - return ( -
  • - {title} -
  • - ); - })} +
      + {list.map((elem, i) => { + const { title } = elem; //destructed in react // + return ( +
    • + {title} +
    • + ); + })}
    -
+
{
-
- - -
+ diff --git a/src/Components/Logo.jsx b/src/Components/Logo.jsx new file mode 100644 index 0000000..13d7974 --- /dev/null +++ b/src/Components/Logo.jsx @@ -0,0 +1,14 @@ +function Logo() { + return ( +
+

+ + + + logo +

+
+ ) +} + +export default Logo \ No newline at end of file From 55c24c6ec94ee922ce85d09ca91130aaf98ea420 Mon Sep 17 00:00:00 2001 From: nabin Date: Sat, 9 Mar 2024 20:52:03 +0545 Subject: [PATCH 2/5] left container comp is added for cart and profile logo --- src/Components/LeftContainer.jsx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/Components/LeftContainer.jsx diff --git a/src/Components/LeftContainer.jsx b/src/Components/LeftContainer.jsx new file mode 100644 index 0000000..bf1be14 --- /dev/null +++ b/src/Components/LeftContainer.jsx @@ -0,0 +1,16 @@ +import { FaCartPlus } from "react-icons/fa"; +import { FaUserCircle } from "react-icons/fa"; + +function LeftContainer() { + return ( + +
+ {/* cart */} + + {/* profile pic */} + +
+ ) +} + +export default LeftContainer \ No newline at end of file From 781a60911418fc2821ab24a6f8df15ba63ec9ea0 Mon Sep 17 00:00:00 2001 From: nabin Date: Sat, 9 Mar 2024 20:55:55 +0545 Subject: [PATCH 3/5] state name changed --- src/Components/Header.jsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Components/Header.jsx b/src/Components/Header.jsx index 4da9256..9d51495 100644 --- a/src/Components/Header.jsx +++ b/src/Components/Header.jsx @@ -7,7 +7,7 @@ import Logo from "./Logo"; const Header = () => { - const [state, setState] = useState(false); + const [clicked, setClicked] = useState(false); const list = [ { title: "Collection" }, { title: "men" }, @@ -22,7 +22,7 @@ const Header = () => { { - setState(true); + setClicked(true); }} className="text-2xl lg:hidden" /> @@ -46,14 +46,14 @@ const Header = () => { id="mobile-navbar" className={clsx( "fixed top-0 left-0 w-screen h-full bg-black/20 backdrop-blur-sm -translate-x-full", - state && "translate-x-0" + clicked && "translate-x-0" )} >
{ - setState(false); + setClicked(false); }} className="text-2xl mb-5 cursor-pointer " /> From b2c13d41f28c48a4357399998e7985f11009364f Mon Sep 17 00:00:00 2001 From: nabin Date: Sat, 9 Mar 2024 21:32:27 +0545 Subject: [PATCH 4/5] title changed --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 0c589ec..3e21e5b 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,7 @@ - Vite + React + My nav
From 7e84b078133639ed53dde17589210b2be6d6768b Mon Sep 17 00:00:00 2001 From: nabin Date: Sat, 9 Mar 2024 21:33:44 +0545 Subject: [PATCH 5/5] mobileResponsive compoennt is added --- src/Components/Header.jsx | 44 +++++++++-------------------- src/Components/MobileResponsive.jsx | 41 +++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 31 deletions(-) create mode 100644 src/Components/MobileResponsive.jsx diff --git a/src/Components/Header.jsx b/src/Components/Header.jsx index 9d51495..7dbd7e8 100644 --- a/src/Components/Header.jsx +++ b/src/Components/Header.jsx @@ -1,24 +1,29 @@ -import { GiHamburgerMenu } from "react-icons/gi"; -import { RxCross1 } from "react-icons/rx"; import { useState } from "react"; -import clsx from "clsx"; + +import { GiHamburgerMenu } from "react-icons/gi"; + +// component import LeftContainer from "./LeftContainer"; import Logo from "./Logo"; +import MobileResponsive from "./MobileResponsive"; const Header = () => { const [clicked, setClicked] = useState(false); + const list = [ { title: "Collection" }, { title: "men" }, { title: "About" }, { title: "Contact" }, ]; + return ( <>
+ { @@ -35,40 +40,17 @@ const Header = () => { const { title } = elem; //destructed in react // return (
  • - {title} -
  • - ); - })} - -
    -
    -
    -
    - { - setClicked(false); - }} - className="text-2xl mb-5 cursor-pointer " - /> -
      - {list.map((elem, i) => { - const { title } = elem; //destructed in react // - return ( -
    • - {title} + + {title} +
    • ); })}
    + +
    diff --git a/src/Components/MobileResponsive.jsx b/src/Components/MobileResponsive.jsx new file mode 100644 index 0000000..a38a4e8 --- /dev/null +++ b/src/Components/MobileResponsive.jsx @@ -0,0 +1,41 @@ +import { RxCross1 } from "react-icons/rx"; +import clsx from "clsx"; + +function MobileResponsive({ clicked, setClicked, list }) { + return ( +
    +
    + + {/* cross icon */} + { + setClicked(false); + }} + className="text-2xl mb-5 cursor-pointer " + /> + +
      + {list.map((elem, i) => { + const { title } = elem; //destructed in react // + return ( +
    • + + {title} + +
    • + ); + })} +
    +
    +
    + ) +} + +export default MobileResponsive \ No newline at end of file