gongxiangp2/components/work-review/WorkReviewStatusBadge.tsx

45 lines
1.3 KiB
TypeScript

import type { WorkReviewDecision, WorkReviewStatus } from '@/types/work-review'
const statusMeta: Record<WorkReviewStatus, { label: string; className: string }> = {
pending_review: {
label: '评审中',
className: 'border-[#b8d0ff] bg-[#edf4ff] text-[#0052d9]',
},
revision_required: {
label: '待修改',
className: 'border-[#f3d29b] bg-[#fff8e8] text-[#8a5200]',
},
approved: {
label: '已通过',
className: 'border-[#b9ead0] bg-[#ecfdf3] text-[#087a3c]',
},
}
export function WorkReviewStatusBadge({
status,
compact = false,
}: {
status: WorkReviewStatus
compact?: boolean
}) {
const meta = statusMeta[status] || statusMeta.pending_review
return (
<span className={`inline-flex shrink-0 items-center rounded-full border font-bold ${meta.className} ${
compact ? 'px-2 py-0.5 text-[10px]' : 'px-2.5 py-1 text-[12px]'
}`}>
{meta.label}
</span>
)
}
export function WorkReviewDecisionBadge({ decision }: { decision: WorkReviewDecision }) {
const approved = decision === 'approved'
return (
<span className={`inline-flex shrink-0 rounded-full px-2 py-0.5 text-[11px] font-bold ${
approved ? 'bg-[#ecfdf3] text-[#087a3c]' : 'bg-[#fff4e5] text-[#8a5200]'
}`}>
{approved ? '通过' : '需修改'}
</span>
)
}