From 437cc35472c28b73659e757029d59ef373547dc6 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 27 Feb 2026 02:20:26 +0000 Subject: [PATCH] fix: responsive navbar with hamburger menu for mobile --- frontend/app/layout.tsx | 44 ++------------------ frontend/components/Navbar.tsx | 74 ++++++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+), 41 deletions(-) create mode 100644 frontend/components/Navbar.tsx diff --git a/frontend/app/layout.tsx b/frontend/app/layout.tsx index 7ebb7ca..88ed7bd 100644 --- a/frontend/app/layout.tsx +++ b/frontend/app/layout.tsx @@ -1,7 +1,7 @@ import type { Metadata } from "next"; import { Geist, Geist_Mono } from "next/font/google"; import "./globals.css"; -import Link from "next/link"; +import Navbar from "@/components/Navbar"; const geistSans = Geist({ variable: "--font-geist-sans", @@ -28,46 +28,8 @@ export default function RootLayout({ - {/* Top nav */} - - -
{children}
+ +
{children}
); diff --git a/frontend/components/Navbar.tsx b/frontend/components/Navbar.tsx new file mode 100644 index 0000000..4e6d651 --- /dev/null +++ b/frontend/components/Navbar.tsx @@ -0,0 +1,74 @@ +"use client"; +import Link from "next/link"; +import { useState } from "react"; + +const navLinks = [ + { href: "/", label: "仪表盘" }, + { href: "/history", label: "历史" }, + { href: "/signals", label: "信号" }, + { href: "/about", label: "说明" }, +]; + +export default function Navbar() { + const [open, setOpen] = useState(false); + + return ( + + ); +}