From 83530d7f1ebd0a2825e66e8f371e8df5843ae05b Mon Sep 17 00:00:00 2001 From: Eamon-meng <17516219072@163.com> Date: Sat, 14 Mar 2026 15:25:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=A7=BB=E5=8A=A8=E7=AB=AF?= =?UTF-8?q?=E8=8F=9C=E5=8D=95=E6=A0=8F=E4=BE=A7=E8=BE=B9=E6=A0=8F=E5=B8=83?= =?UTF-8?q?=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../(home)/_components/header/menu-mobile.tsx | 299 +++++++++++++++++- src/app/(home)/header.tsx | 19 +- 2 files changed, 298 insertions(+), 20 deletions(-) diff --git a/src/app/(home)/_components/header/menu-mobile.tsx b/src/app/(home)/_components/header/menu-mobile.tsx index c1a4a5d..2475ddb 100644 --- a/src/app/(home)/_components/header/menu-mobile.tsx +++ b/src/app/(home)/_components/header/menu-mobile.tsx @@ -1,31 +1,296 @@ -import ProductMenu from './menu-product' -import HelpMenu from './menu-help' -import SolutionMenu from './menu-solution' +'use client' + +import {useContext, useState} from 'react' +import {useRouter} from 'next/navigation' +import {X} from 'lucide-react' +import {HeaderContext} from './common' +import Image, {StaticImageData} from 'next/image' +import prod from '@/assets/header/product/prod.svg' +import custom from '@/assets/header/product/custom.svg' +import s01 from '@/assets/header/solution/01.svg' +import s02 from '@/assets/header/solution/02.svg' +import s03 from '@/assets/header/solution/03.svg' +import s04 from '@/assets/header/solution/04.svg' +import s05 from '@/assets/header/solution/05.svg' +import s06 from '@/assets/header/solution/06.svg' +import s07 from '@/assets/header/solution/07.svg' +import s08 from '@/assets/header/solution/08.svg' +import h01 from '@/assets/header/help/01.svg' +import h02 from '@/assets/header/help/02.svg' +import h03 from '@/assets/header/help/03.svg' +import {merge} from '@/lib/utils' +import Link from 'next/link' +import logo from '@/assets/logo.webp' export type MobileMenuProps = {} export default function MobileMenu(props: MobileMenuProps) { + const ctx = useContext(HeaderContext) + const router = useRouter() + const [productTab, setProductTab] = useState<'domestic' | 'oversea'>('domestic') + + if (!ctx) { + throw new Error(`HeaderContext not found`) + } + + const navigate = (href: string) => { + ctx.setMenu(false) + router.push(href) + } + return ( -
-
- +
+
+ {/* logo */} + + logo + +
-
- - -
-
- - + +
+
+

+ 产品订购 +

+
+ + +
+ + {productTab === 'domestic' && ( +
+ + + +
+ )} + + {productTab === 'oversea' && ( +
+

+ 更多海外节点即将上线,敬请期待~ +

+
+ )} +
+ + +
+ + + + + + + + +
+
+ + +
+ navigate('/collect?type=short')} + /> + navigate('/docs/profile-settings')} + /> + navigate('/docs/ios-proxy')} + /> +
+
+ +
+ +
) } -function MenuTitle(props: {title: string}) { +function MenuSection(props: {title: string, children: React.ReactNode}) { return ( -

- {props.title} -

+
+

+ {props.title} +

+ {props.children} +
+ ) +} + +function ProductItem(props: { + icon: StaticImageData + label: string + badge?: string + href: string + onNavigate: (href: string) => void +}) { + return ( + + ) +} + +function SolutionItem(props: { + icon: StaticImageData + label: string + href: string + onNavigate: (href: string) => void +}) { + return ( + + ) +} + +function HelpItem(props: { + icon: StaticImageData + label: string + onClick: () => void +}) { + return ( + + ) +} + +function OtherLink(props: { + label: string + href: string + onNavigate: (href: string) => void +}) { + return ( + ) } diff --git a/src/app/(home)/header.tsx b/src/app/(home)/header.tsx index 755d330..a8fefd3 100644 --- a/src/app/(home)/header.tsx +++ b/src/app/(home)/header.tsx @@ -164,10 +164,10 @@ export default function Header(props: HeaderProps) {
- {/* 下拉菜单 */} + {/* 桌面端下拉菜单 */}
- {/* 遮罩层 */} + {/* 移动端侧边栏菜单 */} + {menu && page === 3 && ( +
+
+
+ {pages[3]} +
+
+ )} + + {/* 遮罩层(桌面端) */}