diff --git a/src/App.css b/src/App.css index 1750e47..f6c95c2 100644 --- a/src/App.css +++ b/src/App.css @@ -9,4 +9,26 @@ .btn-active { background: #D10056; +} + +.sidebar { + position: fixed; + top: 0; + left: 0; + width: 300px; + /* Adjust the width as needed */ + height: 100vh; + background-color: #fff; + /* Set the background color */ + box-shadow: 0 0 10px rgba(0, 0, 0, 0.2); + /* Add a box-shadow for visual separation */ + transform: translateX(-100%); + /* Initially hide the sidebar */ + transition: transform 0.3s ease-in-out; + /* Add a transition for smooth animation */ +} + +.sidebar.open { + transform: translateX(0); + /* Show the sidebar by removing the translation */ } \ No newline at end of file diff --git a/src/components/Header/Header.tsx b/src/components/Header/Header.tsx index 0bb1add..3347aae 100644 --- a/src/components/Header/Header.tsx +++ b/src/components/Header/Header.tsx @@ -2,22 +2,41 @@ import { useState, ChangeEvent } from "react"; import Logo from "../../assets/icons/logo.svg"; import Button from "../shared/Button"; import { lowerMenuItems } from "../../utils/data"; +import Sidebar from "./Sidebar"; +import { Link } from "react-router-dom"; + +type LowerMenuItem = { + id: string | number; + name: string; +}; const Header = () => { - const [searchValue, setSearchValue] = useState(""); + const [searchValue, setSearchValue] = useState(""); + const [isSidebarOpen, setIsSidebarOpen] = useState(false); const handleSearchChange = (e: ChangeEvent) => { setSearchValue(e.target.value); }; + const toggleSidebar = () => { + setIsSidebarOpen((prev) => !prev); + }; + + console.log(isSidebarOpen); + return (
+ {isSidebarOpen && ( + + )}
- Logo + + Logo +
    {["Open An Account", "Internet Banking", "Contact Us"].map( @@ -41,6 +60,7 @@ const Header = () => { xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" + onClick={toggleSidebar} className="w-6 h-6" > {
    - {lowerMenuItems.map((item) => ( + {lowerMenuItems.map((item: LowerMenuItem) => (
  • void; + isSidebarOpen: boolean; + children?: ReactNode; +}) => { + return ( +
    + {/* Sidebar content goes here */} + +
    + ); +}; + +export default Sidebar diff --git a/src/components/Header/TopHeader.tsx b/src/components/Header/TopHeader.tsx index 0f34c9e..8eb83fb 100644 --- a/src/components/Header/TopHeader.tsx +++ b/src/components/Header/TopHeader.tsx @@ -5,19 +5,25 @@ const TopHeader = () => { return ( <>
    -
    -
      +
        {top_header_data.map(({ id, name }) => (