|
@@ -10,11 +10,26 @@ import {
|
|
|
import Image from "next/image";
|
|
import Image from "next/image";
|
|
|
import Link from "next/link";
|
|
import Link from "next/link";
|
|
|
import { usePathname } from "next/navigation";
|
|
import { usePathname } from "next/navigation";
|
|
|
|
|
+import { useLayout } from "@/components/LayoutProvider";
|
|
|
|
|
|
|
|
export default function Sidebar() {
|
|
export default function Sidebar() {
|
|
|
const pathname = usePathname();
|
|
const pathname = usePathname();
|
|
|
|
|
+ const { mobileMenuOpen, setMobileMenuOpen } = useLayout();
|
|
|
return (
|
|
return (
|
|
|
- <aside className="w-20 lg:w-72 bg-surface border-r border-outline-variant flex flex-col justify-between z-20 shrink-0">
|
|
|
|
|
|
|
+ <>
|
|
|
|
|
+ {/* Mobile backdrop */}
|
|
|
|
|
+ {mobileMenuOpen && (
|
|
|
|
|
+ <div
|
|
|
|
|
+ className="fixed inset-0 bg-background/80 backdrop-blur-sm z-30 lg:hidden"
|
|
|
|
|
+ onClick={() => setMobileMenuOpen(false)}
|
|
|
|
|
+ />
|
|
|
|
|
+ )}
|
|
|
|
|
+
|
|
|
|
|
+ <aside
|
|
|
|
|
+ className={`fixed inset-y-0 left-0 bg-surface border-r border-outline-variant flex flex-col justify-between z-40 w-64 lg:w-72 lg:static shrink-0 transition-transform duration-300 ease-in-out ${
|
|
|
|
|
+ mobileMenuOpen ? "translate-x-0" : "-translate-x-full lg:translate-x-0"
|
|
|
|
|
+ }`}
|
|
|
|
|
+ >
|
|
|
<div>
|
|
<div>
|
|
|
<div className="h-20 flex items-center justify-center px-4 lg:px-6 w-full border-b border-outline-variant/30">
|
|
<div className="h-20 flex items-center justify-center px-4 lg:px-6 w-full border-b border-outline-variant/30">
|
|
|
<Link href="/" className="flex items-center justify-center hover:opacity-80 transition-opacity w-full">
|
|
<Link href="/" className="flex items-center justify-center hover:opacity-80 transition-opacity w-full">
|
|
@@ -23,10 +38,9 @@ export default function Sidebar() {
|
|
|
alt="SEEC Metrics Banner"
|
|
alt="SEEC Metrics Banner"
|
|
|
width={160}
|
|
width={160}
|
|
|
height={40}
|
|
height={40}
|
|
|
- className="object-contain hidden lg:block mx-auto"
|
|
|
|
|
|
|
+ className="object-contain mx-auto"
|
|
|
priority
|
|
priority
|
|
|
/>
|
|
/>
|
|
|
- <GraduationCap className="text-primary w-8 h-8 cursor-pointer lg:hidden mx-auto" />
|
|
|
|
|
</Link>
|
|
</Link>
|
|
|
</div>
|
|
</div>
|
|
|
<nav className="mt-4 px-3 space-y-2">
|
|
<nav className="mt-4 px-3 space-y-2">
|
|
@@ -47,8 +61,8 @@ export default function Sidebar() {
|
|
|
className={`flex items-center px-4 py-3 rounded-full group transition-colors ${activeClass}`}
|
|
className={`flex items-center px-4 py-3 rounded-full group transition-colors ${activeClass}`}
|
|
|
href={item.href}
|
|
href={item.href}
|
|
|
>
|
|
>
|
|
|
- <item.icon className="w-5 h-5" />
|
|
|
|
|
- <span className="ml-3 font-medium hidden lg:block text-sm">
|
|
|
|
|
|
|
+ <item.icon className="w-5 h-5 shrink-0" />
|
|
|
|
|
+ <span className="ml-3 font-medium text-sm">
|
|
|
{item.name}
|
|
{item.name}
|
|
|
</span>
|
|
</span>
|
|
|
</Link>
|
|
</Link>
|
|
@@ -56,8 +70,12 @@ export default function Sidebar() {
|
|
|
})}
|
|
})}
|
|
|
</nav>
|
|
</nav>
|
|
|
</div>
|
|
</div>
|
|
|
- <div className="p-4 lg:p-6">
|
|
|
|
|
- <Link href="/profile" className="flex items-center p-3 rounded-xl bg-surface-container border border-outline-variant/30 hover:bg-surface-container-high cursor-pointer transition-colors group">
|
|
|
|
|
|
|
+ <div className="p-4 lg:p-6 mt-auto">
|
|
|
|
|
+ <Link
|
|
|
|
|
+ href="/profile"
|
|
|
|
|
+ className="flex items-center justify-start p-3 rounded-xl bg-surface-container border border-outline-variant/30 hover:bg-surface-container-high cursor-pointer transition-colors group"
|
|
|
|
|
+ onClick={() => setMobileMenuOpen(false)}
|
|
|
|
|
+ >
|
|
|
<div className="relative shrink-0">
|
|
<div className="relative shrink-0">
|
|
|
<Image
|
|
<Image
|
|
|
alt="User Profile"
|
|
alt="User Profile"
|
|
@@ -69,12 +87,13 @@ export default function Sidebar() {
|
|
|
/>
|
|
/>
|
|
|
<span className="absolute bottom-0 right-0 h-2.5 w-2.5 bg-green-400 rounded-full ring-2 ring-surface-container group-hover:ring-surface-container-high transition-colors"></span>
|
|
<span className="absolute bottom-0 right-0 h-2.5 w-2.5 bg-green-400 rounded-full ring-2 ring-surface-container group-hover:ring-surface-container-high transition-colors"></span>
|
|
|
</div>
|
|
</div>
|
|
|
- <div className="ml-3 hidden lg:block">
|
|
|
|
|
|
|
+ <div className="ml-3">
|
|
|
<p className="text-sm font-medium text-on-surface group-hover:text-primary transition-colors">刘钦</p>
|
|
<p className="text-sm font-medium text-on-surface group-hover:text-primary transition-colors">刘钦</p>
|
|
|
<p className="text-xs text-outline group-hover:text-secondary transition-colors">指导教师</p>
|
|
<p className="text-xs text-outline group-hover:text-secondary transition-colors">指导教师</p>
|
|
|
</div>
|
|
</div>
|
|
|
</Link>
|
|
</Link>
|
|
|
</div>
|
|
</div>
|
|
|
</aside>
|
|
</aside>
|
|
|
|
|
+ </>
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|