From 7e84b078133639ed53dde17589210b2be6d6768b Mon Sep 17 00:00:00 2001 From: nabin Date: Sat, 9 Mar 2024 21:33:44 +0545 Subject: [PATCH] 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