gongxiangp2/components/work-review/WorkReviewHeader.tsx

63 lines
2.1 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

'use client'
import Image from 'next/image'
import Link from 'next/link'
export function WorkReviewHeader({
name,
avatar,
onCreate,
canCreate,
}: {
name: string
avatar?: string | null
canCreate: boolean
onCreate: () => void
}) {
const initials = name.trim().slice(0, 2) || '我'
return (
<header className="sticky top-0 z-30 bg-[#1f2937] text-white shadow-sm">
<div className="mx-auto flex min-h-[64px] w-full max-w-[1280px] items-center justify-between gap-4 px-4 py-3 sm:px-6">
<div className="flex min-w-0 items-center gap-3">
<div className="flex h-9 w-9 shrink-0 items-center justify-center overflow-hidden rounded-full border border-white/15 bg-white/15 text-[12px] font-bold">
{avatar ? (
<Image
src={avatar}
alt={name}
width={36}
height={36}
unoptimized
className="h-full w-full object-cover"
/>
) : initials}
</div>
<div className="min-w-0">
<div className="truncate text-[16px] font-bold">作品过稿看板</div>
<div className="truncate text-[11px] font-medium text-white/65">{name}</div>
</div>
</div>
<div className="flex shrink-0 items-center gap-2">
{canCreate && (
<button
type="button"
onClick={onCreate}
className="inline-flex min-h-9 items-center justify-center rounded bg-[#0050cb] px-3 text-[12px] font-bold text-white transition-colors hover:bg-[#003fa3] sm:px-4 sm:text-[13px]"
>
<span className="mr-1 text-[17px] font-light leading-none">+</span>
提交作品
</button>
)}
<Link
href="/"
className="inline-flex min-h-9 items-center justify-center rounded px-2 text-[12px] font-semibold text-white/80 transition-colors hover:bg-white/10 hover:text-white sm:px-3 sm:text-[13px]"
>
返回素材库
</Link>
</div>
</div>
</header>
)
}