2025-04-25 16:24:04 +08:00
|
|
|
|
'use client'
|
|
|
|
|
|
import {PanelLeftCloseIcon, PanelLeftOpenIcon} from 'lucide-react'
|
|
|
|
|
|
import {Button} from '@/components/ui/button'
|
2025-06-18 17:57:12 +08:00
|
|
|
|
import {useLayoutStore} from '@/app/stores'
|
2025-04-25 16:24:04 +08:00
|
|
|
|
import {merge} from '@/lib/utils'
|
2025-06-06 18:41:19 +08:00
|
|
|
|
import UserCenter from '@/components/composites/user-center'
|
2025-06-18 17:57:12 +08:00
|
|
|
|
import {User} from '@/lib/models'
|
2025-04-25 16:24:04 +08:00
|
|
|
|
|
2025-06-18 17:57:12 +08:00
|
|
|
|
export type HeaderProps = {
|
|
|
|
|
|
profile: User
|
|
|
|
|
|
}
|
2025-04-25 16:24:04 +08:00
|
|
|
|
|
|
|
|
|
|
export default function Header(props: HeaderProps) {
|
|
|
|
|
|
const navbar = useLayoutStore(store => store.navbar)
|
|
|
|
|
|
const toggleNavbar = useLayoutStore(store => store.toggleNavbar)
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
|
<header className={merge(
|
2025-06-09 11:17:38 +08:00
|
|
|
|
`flex-none h-16 overflow-hidden`,
|
2025-04-25 16:24:04 +08:00
|
|
|
|
`flex items-stretch`,
|
|
|
|
|
|
)}>
|
|
|
|
|
|
{/* left */}
|
2025-06-06 18:41:19 +08:00
|
|
|
|
<div className="flex-auto flex items-center gap-2">
|
2025-04-25 16:24:04 +08:00
|
|
|
|
<Button
|
|
|
|
|
|
theme="ghost"
|
2025-06-09 11:17:38 +08:00
|
|
|
|
className="w-9 h-9 ml-4 md:ml-0"
|
2025-04-25 16:24:04 +08:00
|
|
|
|
onClick={toggleNavbar}>
|
|
|
|
|
|
{navbar
|
|
|
|
|
|
? <PanelLeftCloseIcon/>
|
|
|
|
|
|
: <PanelLeftOpenIcon/>
|
|
|
|
|
|
}
|
|
|
|
|
|
</Button>
|
2025-06-09 11:17:38 +08:00
|
|
|
|
<span className="max-md:hidden">
|
2025-04-25 16:24:04 +08:00
|
|
|
|
欢迎来到,蓝狐代理
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
{/* right */}
|
2025-06-06 18:41:19 +08:00
|
|
|
|
<div className="flex-none flex items-center justify-end pr-4">
|
2025-06-18 17:57:12 +08:00
|
|
|
|
<UserCenter profile={props.profile}/>
|
2025-04-25 16:24:04 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</header>
|
|
|
|
|
|
)
|
|
|
|
|
|
}
|