Files
ftb-project-management/apps/web/lib/requirement-table-layout.ts
2026-07-03 09:43:36 +08:00

32 lines
1.4 KiB
TypeScript

export type RequirementTableTextColumn = 'source' | 'project' | 'type' | 'version' | 'creator';
const TEXT_COLUMN_MAX_WIDTH: Record<RequirementTableTextColumn, string> = {
source: 'max-w-[170px]',
project: 'max-w-[120px]',
type: 'max-w-[96px]',
version: 'max-w-[92px]',
creator: 'max-w-[96px]',
};
export const REQUIREMENT_TABLE_CONTAINER_CLASS =
'overflow-hidden rounded-2xl border border-[var(--line)] bg-[var(--bg-card)] shadow-[var(--shadow-sm)]';
export const REQUIREMENT_TABLE_CLASS = 'w-full table-fixed text-left text-[13px]';
export const REQUIREMENT_TABLE_COLUMN_WIDTHS = [6, 15, 14, 7, 6, 6, 5, 6, 7, 6, 8, 14] as const;
export const REQUIREMENT_TABLE_HEADER_CELL_CLASS =
'px-3 py-2.5 whitespace-nowrap text-[11px] font-medium uppercase tracking-wide text-[var(--ink-muted)]';
export const REQUIREMENT_TABLE_NOWRAP_CELL_CLASS = 'px-3 py-3 whitespace-nowrap';
export const REQUIREMENT_TABLE_BADGE_CLASS =
'inline-flex h-6 min-w-[3.25rem] shrink-0 items-center justify-center whitespace-nowrap rounded-md px-2 py-0.5 text-[11px] font-medium';
export const REQUIREMENT_TABLE_SMALL_BADGE_CLASS =
'inline-flex h-5 min-w-[2.75rem] shrink-0 items-center justify-center whitespace-nowrap rounded-md px-2 py-0.5 text-[10px] font-medium';
export function getRequirementTableTextClass(column: RequirementTableTextColumn): string {
return `block truncate ${TEXT_COLUMN_MAX_WIDTH[column]}`;
}