2025-03-18 18:00:29 +08:00
|
|
|
|
'use client'
|
|
|
|
|
|
|
2025-03-24 11:45:54 +08:00
|
|
|
|
import {useContext, useState} from 'react'
|
|
|
|
|
|
import Wrap from '@/components/wrap'
|
|
|
|
|
|
import Image from 'next/image'
|
2025-03-18 18:00:29 +08:00
|
|
|
|
import anno from '@/assets/header/product/anno.svg'
|
2025-03-24 11:45:54 +08:00
|
|
|
|
import {Domestic, Oversea, Tab} from '@/app/(root)/@header/_server/product'
|
|
|
|
|
|
import Link from 'next/link'
|
|
|
|
|
|
import {merge} from '@/lib/utils'
|
|
|
|
|
|
import {HeaderContext} from '@/app/(root)/@header/page'
|
2025-03-18 18:00:29 +08:00
|
|
|
|
|
|
|
|
|
|
type TabType = 'domestic' | 'oversea'
|
|
|
|
|
|
|
|
|
|
|
|
export default function ProductMenu() {
|
|
|
|
|
|
|
|
|
|
|
|
const [type, setType] = useState<TabType>('domestic')
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
|
<Wrap className="flex">
|
|
|
|
|
|
<ul role="tablist" className="w-48">
|
|
|
|
|
|
<Tab selected={type === 'domestic'} onSelect={() => setType('domestic')}>国内代理</Tab>
|
|
|
|
|
|
<Tab selected={type === 'oversea'} onSelect={() => setType('oversea')}>海外代理</Tab>
|
|
|
|
|
|
</ul>
|
|
|
|
|
|
<div className="flex-1">
|
|
|
|
|
|
{type === 'domestic'
|
|
|
|
|
|
? (
|
2025-03-24 11:45:54 +08:00
|
|
|
|
<Domestic/>
|
2025-03-18 18:00:29 +08:00
|
|
|
|
) : (
|
2025-03-24 11:45:54 +08:00
|
|
|
|
<Oversea/>
|
2025-03-18 18:00:29 +08:00
|
|
|
|
)
|
|
|
|
|
|
}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<aside className="w-64">
|
|
|
|
|
|
<h3 className="flex gap-3 items-center mb-4">
|
2025-03-24 11:45:54 +08:00
|
|
|
|
<Image src={anno} alt={`公告`} className={`w-10 h-10`}/>
|
2025-03-18 18:00:29 +08:00
|
|
|
|
<span>网站公告</span>
|
|
|
|
|
|
</h3>
|
|
|
|
|
|
<div className="flex flex-col gap-2">
|
|
|
|
|
|
<p>官网最新上线,体验再升级!</p>
|
|
|
|
|
|
<p className="text-gray-400 text-sm">
|
|
|
|
|
|
1.新增多样使用功能,新增多样使用
|
|
|
|
|
|
新增多样使用功能
|
|
|
|
|
|
</p>
|
|
|
|
|
|
<p className="text-gray-400 text-sm">
|
|
|
|
|
|
2.新增多样使用功能,新增多样使用
|
|
|
|
|
|
新增多样使用功能
|
|
|
|
|
|
</p>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</aside>
|
|
|
|
|
|
</Wrap>
|
|
|
|
|
|
)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-03-24 11:45:54 +08:00
|
|
|
|
export function DomesticLink(props: {
|
|
|
|
|
|
label: string
|
|
|
|
|
|
desc: string
|
|
|
|
|
|
href: string
|
|
|
|
|
|
discount: number
|
2025-03-18 18:00:29 +08:00
|
|
|
|
}) {
|
2025-03-24 11:45:54 +08:00
|
|
|
|
const ctx = useContext(HeaderContext)
|
|
|
|
|
|
if (!ctx) {
|
|
|
|
|
|
throw new Error(`HeaderContext not found`)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const onClick = () => {
|
|
|
|
|
|
ctx.setMenu(false)
|
|
|
|
|
|
}
|
2025-03-18 18:00:29 +08:00
|
|
|
|
|
|
|
|
|
|
return (
|
2025-03-24 11:45:54 +08:00
|
|
|
|
<Link href={props.href} className={merge(
|
|
|
|
|
|
`transition-colors duration-150 ease-in-out`,
|
|
|
|
|
|
`p-4 rounded-lg flex flex-col gap-2 hover:bg-blue-50`,
|
|
|
|
|
|
)} onClick={onClick}>
|
|
|
|
|
|
<p className="flex gap-2">
|
|
|
|
|
|
<span>{props.label}</span>
|
|
|
|
|
|
<span className="text-orange-500 text-xs text-light px-2 py-1 bg-orange-50 rounded-full">
|
|
|
|
|
|
折扣{props.discount}%
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</p>
|
|
|
|
|
|
<p className="text-gray-400 text-sm">
|
|
|
|
|
|
{props.desc}
|
|
|
|
|
|
</p>
|
|
|
|
|
|
</Link>
|
2025-03-18 18:00:29 +08:00
|
|
|
|
)
|
2025-03-24 11:45:54 +08:00
|
|
|
|
}
|