Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 20x 20x 20x 20x 20x 20x 20x 20x 20x 20x 20x 20x 1x 1x | 'use client';
import type { ErrorPriority } from '@prisma/client';
export interface PriorityBadgeProps {
/** Priority level */
priority: ErrorPriority | string;
/** Optional additional className */
className?: string;
}
const priorityConfig: Record<string, { label: string; className: string }> = {
LOW: {
label: 'Low',
className: 'bg-gray-100 text-gray-700 dark:bg-gray-700 dark:text-gray-300',
},
MEDIUM: {
label: 'Medium',
className: 'bg-blue-100 text-blue-700 dark:bg-blue-900 dark:text-blue-300',
},
HIGH: {
label: 'High',
className: 'bg-orange-100 text-orange-700 dark:bg-orange-900 dark:text-orange-300',
},
CRITICAL: {
label: 'Critical',
className: 'bg-red-100 text-red-700 dark:bg-red-900 dark:text-red-300',
},
};
/**
* PriorityBadge Component
*
* Displays error priority with appropriate color coding.
*/
export function PriorityBadge({ priority, className = '' }: PriorityBadgeProps) {
const config = priorityConfig[priority] || priorityConfig.MEDIUM;
return (
<span
className={`inline-flex items-center px-2 py-0.5 text-xs font-medium rounded ${config.className} ${className}`}
data-testid="priority-badge"
>
{config.label}
</span>
);
}
export default PriorityBadge;
|