Files
botsmann/components/shared/DocumentStatusBadge.tsx
g-butandClaude Opus 4.5 6da1c37668 refactor: extract document status to constants and shared component (SSOT)
- Added DOCUMENT_STATUS constant to lib/constants.ts
- Added DocumentStatusType derived from constant
- Added DOCUMENT_STATUS_CONFIG for display (labels, colors)
- Created DocumentStatusBadge shared component
- Updated types/document.ts to use DocumentStatusType
- Updated app/documents/page.tsx to use shared component and constants

Changes to add a new status now require only 1 file (lib/constants.ts).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 18:45:37 +01:00

28 lines
660 B
TypeScript

/**
* Document Status Badge Component
*
* SSOT for document status badge rendering.
* Uses centralized status config from lib/constants.ts
*/
import { DOCUMENT_STATUS_CONFIG, type DocumentStatusType } from '@/lib/constants';
interface DocumentStatusBadgeProps {
status: DocumentStatusType;
className?: string;
}
export function DocumentStatusBadge({ status, className = '' }: DocumentStatusBadgeProps) {
const config = DOCUMENT_STATUS_CONFIG[status];
if (!config) return null;
return (
<span
className={`px-2 py-1 text-xs ${config.bgColor} ${config.color} rounded-full ${className}`}
>
{config.label}
</span>
);
}