118 lines
5.1 KiB
TypeScript
118 lines
5.1 KiB
TypeScript
'use client'
|
||
|
||
import Image from 'next/image'
|
||
import Link from 'next/link'
|
||
import { useEffect } from 'react'
|
||
import BrandLogo from '@/components/BrandLogo'
|
||
import { DEFAULT_LOGIN_LOGO_URL } from '@/lib/brand-assets'
|
||
|
||
export function WorkReviewHeader({
|
||
name,
|
||
avatar,
|
||
secondaryAction,
|
||
primaryAction,
|
||
wide = false,
|
||
}: {
|
||
name: string
|
||
avatar?: string | null
|
||
secondaryAction?: {
|
||
label: string
|
||
onClick: () => void
|
||
icon: 'add' | 'back'
|
||
}
|
||
primaryAction?: {
|
||
label: string
|
||
onClick: () => void
|
||
icon: 'add' | 'back'
|
||
}
|
||
wide?: boolean
|
||
}) {
|
||
const initials = name.trim().slice(0, 2) || '我'
|
||
|
||
useEffect(() => {
|
||
document.title = '由壹点·品牌中心 · 作品过稿看板'
|
||
}, [])
|
||
|
||
return (
|
||
<header className="sticky top-0 z-30 border-b border-[#e7e8ea] bg-[#fafafa]">
|
||
<div className={`mx-auto flex min-h-[64px] w-full flex-wrap items-center justify-between gap-x-4 gap-y-2 px-4 py-3 sm:flex-nowrap sm:px-6 ${wide ? 'max-w-[1600px]' : 'max-w-[1280px]'}`}>
|
||
<div className="flex min-w-0 items-center gap-2.5">
|
||
<Link
|
||
href="/"
|
||
aria-label="返回品牌中心首页"
|
||
className="flex shrink-0 items-center gap-2 rounded-sm text-[13px] font-semibold tracking-tight text-[#1a1c1d] transition-opacity hover:opacity-70 focus:outline-none focus-visible:ring-2 focus-visible:ring-[#1a1c1d]/70 focus-visible:ring-offset-2 focus-visible:ring-offset-[#fafafa]"
|
||
>
|
||
<BrandLogo
|
||
src={DEFAULT_LOGIN_LOGO_URL}
|
||
fallbackSrc={DEFAULT_LOGIN_LOGO_URL}
|
||
alt=""
|
||
width={28}
|
||
height={28}
|
||
unoptimized
|
||
className="h-7 w-7 rounded-md object-cover"
|
||
/>
|
||
<span className="hidden lg:inline">由壹点·品牌中心</span>
|
||
</Link>
|
||
<span aria-hidden="true" className="text-[12px] text-[#d4d6da]">/</span>
|
||
<div className="min-w-0">
|
||
<div className="truncate text-[15px] font-semibold tracking-[-0.02em] text-[#1a1c1d]">作品过稿看板</div>
|
||
<div className="font-en mt-0.5 truncate text-[10px] uppercase tracking-[0.14em] text-[#86898e]">Review board</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div className={`flex shrink-0 items-center gap-2 ${secondaryAction ? 'w-full sm:w-auto' : ''}`}>
|
||
<div className="hidden items-center gap-2 border-r border-[#e7e8ea] pr-3 sm:flex">
|
||
<div className="flex h-7 w-7 shrink-0 items-center justify-center overflow-hidden rounded-full border border-[#e7e8ea] bg-[#e9ebef] text-[10px] font-bold text-[#1a1c1d]">
|
||
{avatar ? (
|
||
<Image
|
||
src={avatar}
|
||
alt={name}
|
||
width={28}
|
||
height={28}
|
||
unoptimized
|
||
className="h-full w-full object-cover"
|
||
/>
|
||
) : initials}
|
||
</div>
|
||
<span className="max-w-24 truncate text-[12px] text-[#6b7075]">{name}</span>
|
||
</div>
|
||
{secondaryAction && (
|
||
<button
|
||
type="button"
|
||
onClick={secondaryAction.onClick}
|
||
className="inline-flex min-h-10 flex-1 items-center justify-center rounded-lg bg-[#1a1c1d] px-3 text-[12px] font-bold text-white transition-all hover:opacity-80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#1a1c1d]/60 focus-visible:ring-offset-2 focus-visible:ring-offset-[#fafafa] sm:min-h-9 sm:flex-none sm:px-4 sm:text-[13px]"
|
||
>
|
||
<span className="mr-1 text-[17px] font-light leading-none" aria-hidden="true">
|
||
{secondaryAction.icon === 'add' ? '+' : '←'}
|
||
</span>
|
||
{secondaryAction.label}
|
||
</button>
|
||
)}
|
||
{primaryAction && (
|
||
<button
|
||
type="button"
|
||
onClick={primaryAction.onClick}
|
||
className={`inline-flex items-center justify-center rounded-lg px-3 text-[12px] font-bold transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#1a1c1d]/60 focus-visible:ring-offset-2 focus-visible:ring-offset-[#fafafa] sm:min-h-9 sm:px-4 sm:text-[13px] ${
|
||
secondaryAction
|
||
? 'min-h-10 flex-1 border border-[#1a1c1d] bg-white text-[#1a1c1d] hover:bg-[#1a1c1d] hover:text-white sm:flex-none'
|
||
: 'min-h-9 bg-[#1a1c1d] text-white hover:opacity-80'
|
||
}`}
|
||
>
|
||
<span className="mr-1 text-[17px] font-light leading-none" aria-hidden="true">
|
||
{primaryAction.icon === 'add' ? '+' : '←'}
|
||
</span>
|
||
{primaryAction.label}
|
||
</button>
|
||
)}
|
||
<Link
|
||
href="/materials"
|
||
className="inline-flex min-h-10 items-center justify-center rounded-lg px-2 text-[12px] font-semibold text-[#6b7075] transition-colors hover:bg-[#e9ebef] hover:text-[#1a1c1d] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#1a1c1d]/60 sm:min-h-9 sm:px-3 sm:text-[13px]"
|
||
>
|
||
创意资产库
|
||
</Link>
|
||
</div>
|
||
</div>
|
||
</header>
|
||
)
|
||
}
|