diff --git a/app/components/Header.tsx b/app/components/Header.tsx index 5a02425..8a930e3 100644 --- a/app/components/Header.tsx +++ b/app/components/Header.tsx @@ -1,85 +1,54 @@ -import React, { useState, useRef, useEffect } from 'react'; +import React, { useState } from 'react'; import Login from './Login'; interface HeaderProps { - onViewChange: (view: 'AI' | 'FAQ' | 'Documentation' | 'Credits') => void; - showDivs: boolean; - toggleDivs: () => void; - showHistoryModelsToggle: boolean; - showToggle: boolean; + onViewChange: (view: 'AI' | 'FAQ' | 'Documentation' | 'Credits') => void; // Include 'Credits' + showDivs: boolean; + toggleDivs: () => void; + showHistoryModelsToggle: boolean; + showToggle: boolean; } -const Header: React.FC = ({ - onViewChange, - showDivs, - toggleDivs, - showHistoryModelsToggle, - showToggle, -}) => { - const [menuOpen, setMenuOpen] = useState(false); - const dropdownRef = useRef(null); - const toggleRef = useRef(null); +const Header: React.FC = ({ onViewChange, showDivs, toggleDivs, showHistoryModelsToggle, showToggle }) => { + const [menuOpen, setMenuOpen] = useState(false); - // Toggle menu state - const toggleMenu = () => { - setMenuOpen((prevMenuOpen) => !prevMenuOpen); - }; + const toggleMenu = () => { + setMenuOpen(!menuOpen); + }; - // Handle button click - const buttonClicked = (page: "AI" | "Documentation" | "FAQ" | "Credits") => { - onViewChange(page); - setMenuOpen(false); // Close the menu when a button is clicked - }; + const buttonClicked = (page: "AI" | "Documentation" | "FAQ" | "Credits") => { // Add 'Credits' to the options here + onViewChange(page); + toggleMenu(); + }; - // Effect to handle clicks outside of the dropdown - useEffect(() => { - const handleClickOutside = (event: MouseEvent) => { - // Check if the click is outside both the dropdown and the hamburger menu - if ( - dropdownRef.current && - !dropdownRef.current.contains(event.target as Node) && - toggleRef.current && - !toggleRef.current.contains(event.target as Node) - ) { - setMenuOpen(false); - } - }; - - document.addEventListener('mousedown', handleClickOutside); - - return () => { - document.removeEventListener('mousedown', handleClickOutside); - }; - }, []); - - return ( - <> -
- {showToggle && showHistoryModelsToggle && ( - - )} - -
- - - -
-
- {/* AI logo or text */} -
-
- -
-
- - ); + return ( + <> +
+
+ + + +
+ +
+ {/* AI logo or text */} +
+
+ +
+
+ + ); }; export default Header; diff --git a/app/styles/header.css b/app/styles/header.css index 5c3a2e5..9f30d31 100644 --- a/app/styles/header.css +++ b/app/styles/header.css @@ -1,4 +1,4 @@ -header { +header{ position: relative; padding: 0 20px; width: 100%; @@ -10,16 +10,15 @@ header { z-index: 999; } -/* Hamburger button styles */ -.hamburger { +.hamburger{ position: absolute; left: 5vw; - display: flex; /* Always show hamburger button */ + display: none; flex-direction: column; cursor: pointer; } -.hamburger span { +.hamburger span{ width: 25px; height: 3px; background-color: white; @@ -27,53 +26,43 @@ header { transition: 0.3s; } -.hamburger.open span:nth-child(1) { +.hamburger.open span:nth-child(1){ transform: rotate(45deg) translate(5px, 10px); } -.hamburger.open span:nth-child(2) { +.hamburger.open span:nth-child(2){ opacity: 0; } -.hamburger.open span:nth-child(3) { +.hamburger.open span:nth-child(3){ transform: rotate(-45deg) translate(5px, -10px); } -/* Navigation links (hidden in header, shown in dropdown) */ -.nav-links { - display: none; /* Default hidden */ + + +.nav-links{ position: absolute; - top: 10vh; /* Adjust as needed */ - left: 0; - background-color: var(--burger-menu-background-color); - width: 100%; - flex-direction: column; - align-items: flex-start; - padding: 10px; + left: 1vw; + display: flex; + gap: 0.5vw; + width:max-content; + height: 100%; + align-items: center; } -.nav-links.active { - display: flex; /* Show when active */ - height: fit-content; -} - -.nav-btn { +.nav-btn{ background-color: var(--input-button-color); border: none; font-size: 0.9em; - height: 50px; /* Consistent height */ + height: 50%; border-radius: 5px; - padding: 10px; + padding: 2px 15px; font-family: var(--font-family); - width: 100%; /* Full width */ - text-align: center; /* Center text */ - margin: 4px; } -.nav-btn:hover { +.nav-btn:hover{ background-color: var(--input-button-hover-color); } -/* Logo styles */ -.header-logo { +.header-logo{ width: 250px; height: 5vh; background-image: url(../../public/img/logo.png); @@ -84,8 +73,7 @@ header { border: none; } -/* Login button styles */ -.login-button-container { +.login-button-container{ position: absolute; top: 0.1vh; right: 1vw; @@ -94,9 +82,9 @@ header { align-items: center; } -.header-login-button { +.header-login-button{ height: 100%; - width: max-content; + width:max-content; font-size: var(--font-size); padding: 0.5vw 1vw; background-color: var(--input-button-color); @@ -113,12 +101,4 @@ header { .header-login-button:hover { background-color: var(--input-button-hover-color); -} - -.show-hide-btn{ - width: fit-content; - align-self: left; - position: absolute; - left: 10vw; - cursor: pointer; } \ No newline at end of file diff --git a/app/styles/responsive.css b/app/styles/responsive.css index 938106e..ae65dfd 100644 --- a/app/styles/responsive.css +++ b/app/styles/responsive.css @@ -22,7 +22,7 @@ width: 100vw; overflow: hidden; margin: 0; - padding: 1dvh 0 0 0; + padding: 1dvh 0 0 0 ; } /* Left panel styles */ @@ -100,19 +100,20 @@ margin: 0; } - .header-logo { + .header-logo{ position: relative; + margin-left: -40px; } - .hamburger.open { + .hamburger.open{ margin-top: 0.5vh; padding-left: 1vw; } - .nav-links { - display: none; /* Hidden by default */ + .nav-links{ + display: none; position: absolute; - top: 10vh; /* Adjust as needed */ + top: 10vh; left: 0; background-color: var(--burger-menu-background-color); width: 100%; @@ -122,42 +123,24 @@ height: fit-content; } - .nav-links.active { - display: flex; /* Show when active */ + .nav-links.active{ + display: flex; height: fit-content; } - .nav-btn { + .nav-btn{ width: 100%; text-align: center; padding: 10px; height: 50px; - background-color: var(--input-button-color); - border: none; - font-size: 0.9em; - border-radius: 5px; } - - .nav-btn:hover { - background-color: var(--input-button-hover-color); - } - + .hamburger { - display: flex; /* Always show hamburger button */ + display: flex; } - .header-login-button { - right: 5vh; /* Keep login button visible */ - } - - .show-hide-btn{ - width: fit-content; - left: 20vw; - } - - .header-logo { - background-image: url(../../public/img/logo-small.png); - width: 4em; + .header-login-button{ + right: 5vh; } } diff --git a/public/img/logo-small.png b/public/img/logo-small.png deleted file mode 100644 index bc31fbd..0000000 Binary files a/public/img/logo-small.png and /dev/null differ