7 lines
921 B
TypeScript
7 lines
921 B
TypeScript
"use client";
|
|
import Link from "next/link";
|
|
import { usePathname } from "next/navigation";
|
|
import { useState } from "react";
|
|
const links=[["/","首页"],["/advantages","合作优势"],["/process","合作流程"],["/cases","合作场景"],["/faq","常见问题"],["/contact","联系"]];
|
|
export function SiteNav(){const path=usePathname();const [open,setOpen]=useState(false);return <header><div className="shell nav"><Link className="brand" href="/" onClick={()=>setOpen(false)}>COZ<span>CREATOR</span></Link><button className="menu" type="button" aria-label={open?"关闭导航":"打开导航"} aria-expanded={open} onClick={()=>setOpen(!open)}><i/><i/></button><nav className={open?"open":""}>{links.map(([href,label])=><Link className={path===href?"active":""} href={href} key={href} onClick={()=>setOpen(false)}>{label}</Link>)}<Link className="nav-cta" href="/contact">成为合作伙伴</Link></nav></div></header>}
|