interstellar_ai/app/components/Header.tsx

54 lines
1.6 KiB
TypeScript
Raw Normal View History

2024-09-18 10:03:36 +02:00
// Header.tsx
2024-09-24 14:54:39 +02:00
import React, { useState } from 'react';
2024-09-20 10:00:54 +02:00
import Login from './Login';
2024-09-18 10:03:36 +02:00
interface HeaderProps {
2024-09-19 09:54:00 +02:00
onViewChange: (view: 'AI' | 'FAQ' | 'Documentation') => void;
2024-09-19 12:18:04 +02:00
showDivs: boolean;
toggleDivs: () => void;
2024-09-19 09:54:00 +02:00
showHistoryModelsToggle: boolean;
2024-09-19 12:18:04 +02:00
showToggle: boolean; // Add this prop
2024-09-18 10:03:36 +02:00
}
2024-09-19 12:18:04 +02:00
const Header: React.FC<HeaderProps> = ({ onViewChange, showDivs, toggleDivs, showHistoryModelsToggle, showToggle }) => {
2024-09-24 14:54:39 +02:00
const [menuOpen, setMenuOpen] = useState(false)
const toggleMenu = () => {
setMenuOpen(!menuOpen)
}
2024-09-25 11:22:59 +02:00
const buttonClicked = (page: "AI" | "Documentation" | "FAQ") => {
onViewChange(page)
toggleMenu()
}
2024-09-18 10:03:36 +02:00
return (
2024-09-20 10:00:54 +02:00
<>
<header>
2024-09-24 14:54:39 +02:00
<div className={`hamburger ${menuOpen ? "open" : ""}`} onClick={toggleMenu}>
<span></span>
<span></span>
<span></span>
</div>
<nav className={`nav-links ${menuOpen ? "active":""}`}>
2024-09-25 11:22:59 +02:00
<button onClick={() => buttonClicked("FAQ")} className="nav-btn">FAQ</button>
<button onClick={() => buttonClicked("Documentation")} className="nav-btn">Documentation</button>
2024-09-24 14:54:39 +02:00
{showToggle && showHistoryModelsToggle && (
<button onClick={toggleDivs} className="nav-btn">
2024-09-20 10:00:54 +02:00
{showDivs ? 'Hide History/Models' : 'Show History/Models'}
</button>
2024-09-24 14:54:39 +02:00
)}
</nav>
2024-09-25 11:22:59 +02:00
<button onClick={() => onViewChange('AI')} className="header-button header-logo">
2024-09-25 11:40:17 +02:00
2024-09-25 11:22:59 +02:00
</button>
<div className="login-button">
<Login />
</div>
2024-09-20 10:00:54 +02:00
</header>
</>
2024-09-18 10:03:36 +02:00
);
};
export default Header;