flowstate/app/(app)/dashboard/components/KanbanCardPriority.tsx

31 lines
902 B
TypeScript

/**
* @file dashboard/components/KanbanCardPriority.tsx
* @description Client component rendering the dynamic priority badge for a kanban card based on configuration.
*/
import { TaskPriority, PRIORITY_CONFIG } from "@/types/tasks";
/**
* Renders a styled priority badge for a kanban card.
*
* @param {Object} props - The component props.
* @param {TaskPriority} props.priority - The priority level of the task.
* @returns {JSX.Element | null} The rendered priority badge component, or null if priority is invalid.
*/
export default function KanbanCardPriority({
priority,
}: {
priority: TaskPriority;
}) {
if (!priority || !PRIORITY_CONFIG[priority]) return null;
const { label, className } = PRIORITY_CONFIG[priority];
return (
<span
className={`gap-1.5 px-2.5 py-1 rounded-lg text-xs font-bold border-2 shrink-0 ${className}`}
>
{label}
</span>
);
}