| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- "use client";
- import { Menu, Search, Bell, HelpCircle, X } from "lucide-react";
- import { ThemeToggle } from "@/components/ThemeToggle";
- import { useLayout } from "@/components/LayoutProvider";
- import { useState } from "react";
- import Image from "next/image";
- export default function Header() {
- const { setMobileMenuOpen } = useLayout();
- const [isSearchOpen, setIsSearchOpen] = useState(false);
- return (
- <header className="h-20 flex items-center justify-between px-6 lg:px-8 border-b border-outline-variant/30 z-10 bg-background/95 backdrop-blur-sm sticky top-0">
- <div className="flex items-center w-full max-w-xl">
- <button
- className="lg:hidden mr-4 shrink-0 text-secondary hover:text-on-surface transition-colors"
- onClick={() => setMobileMenuOpen(true)}
- >
- <Menu className="w-6 h-6" />
- </button>
- {/* Mobile Banner */}
- <div className="lg:hidden flex-1 flex items-center">
- <Image
- src="/banner.png"
- alt="SEEC Metrics Banner"
- width={120}
- height={30}
- className="object-contain"
- priority
- />
- </div>
-
- {/* Desktop Search (hidden on mobile) */}
- <div className="relative w-full hidden lg:block">
- <span className="absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none">
- <Search className="w-5 h-5 text-outline" />
- </span>
- <input
- className="w-full py-2.5 pl-10 pr-4 bg-surface-container-high border-none rounded-full focus:ring-1 focus:ring-primary text-sm placeholder-outline text-on-surface transition-all shadow-inner outline-none focus:outline-none"
- placeholder="搜索能力指标、学生名单..."
- type="text"
- />
- </div>
-
- {/* Mobile Search Button */}
- <button
- className="lg:hidden p-2 text-secondary hover:text-on-surface"
- onClick={() => setIsSearchOpen(true)}
- >
- <Search className="w-5 h-5" />
- </button>
- </div>
- {/* Mobile Expanded Search Overlay */}
- {isSearchOpen && (
- <div className="absolute inset-y-0 left-0 right-0 bg-background/95 backdrop-blur-sm z-20 flex items-center px-4 lg:hidden">
- <div className="relative w-full flex items-center">
- <span className="absolute left-3 flex items-center pointer-events-none">
- <Search className="w-5 h-5 text-outline" />
- </span>
- <input
- autoFocus
- className="w-full py-2 pl-10 pr-10 bg-surface-container-high border-none rounded-full focus:ring-1 focus:ring-primary text-sm placeholder-outline text-on-surface outline-none"
- placeholder="搜索能力指标、学生名单..."
- type="text"
- />
- <button
- className="absolute right-3 p-1 rounded-full hover:bg-surface-variant text-secondary"
- onClick={() => setIsSearchOpen(false)}
- >
- <X className="w-4 h-4" />
- </button>
- </div>
- </div>
- )}
- <div className="flex items-center space-x-3">
- <ThemeToggle />
- <button className="p-2 rounded-full hover:bg-surface-container-high text-secondary hover:text-on-surface transition-colors relative">
- <Bell className="w-6 h-6" />
- <span className="absolute top-2.5 right-2.5 h-2 w-2 bg-chart-2 rounded-full ring-2 ring-background"></span>
- </button>
- <button className="p-2 rounded-full hover:bg-surface-container-high text-secondary hover:text-on-surface transition-colors">
- <HelpCircle className="w-6 h-6" />
- </button>
- </div>
- </header>
- );
- }
|