From b539c3592a2aa896e970344dae7101e04eea8258 Mon Sep 17 00:00:00 2001 From: YasinOnm08 Date: Tue, 24 Sep 2024 14:54:39 +0200 Subject: [PATCH] started hamburger menu --- app/components/Header.tsx | 41 ++++++++++-------- app/styles/header.css | 91 +++++++++++++++++++++++++++++++-------- 2 files changed, 95 insertions(+), 37 deletions(-) diff --git a/app/components/Header.tsx b/app/components/Header.tsx index 96721bd..26a3f99 100644 --- a/app/components/Header.tsx +++ b/app/components/Header.tsx @@ -1,5 +1,5 @@ // Header.tsx -import React from 'react'; +import React, { useState } from 'react'; import Login from './Login'; interface HeaderProps { @@ -11,29 +11,32 @@ interface HeaderProps { } const Header: React.FC = ({ onViewChange, showDivs, toggleDivs, showHistoryModelsToggle, showToggle }) => { + const [menuOpen, setMenuOpen] = useState(false) + + const toggleMenu = () => { + setMenuOpen(!menuOpen) + } + return ( <>
-
    -
  • - -
  • -
  • - -
  • -
  • - -
  • - {showToggle && showHistoryModelsToggle && ( -
  • - + + {showToggle && showHistoryModelsToggle && ( + -
  • - )} -
+ )} + + {/* */}
diff --git a/app/styles/header.css b/app/styles/header.css index eed0f9e..c630cb2 100644 --- a/app/styles/header.css +++ b/app/styles/header.css @@ -10,29 +10,84 @@ header { box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); z-index: 1000; font-family: var(--font-family); + display: flex; + justify-content: space-between; + align-items: center; } -header li { - display: inline-block; - margin: 0 15px; +.nav-links{ + display: flex; + gap: 15px; } -header img { - height: 2em; - vertical-align: middle; -} - -header a, -header li button { - color: var(--header-text-color); /* Use the new header text color */ - text-decoration: none; - transition: color 0.3s; +.nav-btn{ + background: transparent; border: none; - background-color: transparent; - font-size: 1em; + cursor: pointer; + /* color */ } -header a:hover, -header li button:hover { - color: var(--input-button-color); /* Keep the hover color */ +.nav-btn:hover{ + /* color */ } + +.hamburger{ + display: none; + flex-direction: column; + cursor: pointer; +} + +.hamburger span{ + width: 25px; + height: 3px; + background-color: var(--header-text-color); + margin: 4px; + transition: 0.3s; +} + +.hamburger.open span:nth-child(1){ + transform: rotate(45deg) translate(5px, 5px); +} + +.hamburger.open span:nth-child(2){ + opacity: 0; +} + +.hamburger.open span:nth-child(3){ + transform: rotate(-45deg) translate(5px, -5px); +} + +.header-button{ + +} +.header-button img{ + height: 8vh; +} + +@media (max-width:768px) { + .nav-links{ + display: none; + position: absolute; + top: 60px; + right: 0; + /* background color */ + width: 100%; + flex-direction: column; + align-items: flex-start; + padding: 10px; + } + + .nav-links.active{ + display: flex; + } + + .nav-btn{ + width: 100%; + text-align: center; + padding: 10px; + } + + .hamburger{ + display: flex; + } +} \ No newline at end of file