full-stack/client/src/utils/priorityUtils.ts
2025-06-17 17:41:16 +08:00

25 lines
605 B
TypeScript

import type { Priority } from '../types/todo';
export const priorityLabels: { [key in Priority]: string } = {
low: '低',
medium: '中',
high: '高',
};
export const getPriorityTagColor = (priority: Priority): string => {
switch (priority) {
case 'low': return 'green';
case 'medium': return 'orange';
case 'high': return 'red';
default: return 'default';
}
};
export const getPriorityIcon = (priority: Priority): string => {
switch (priority) {
case 'low': return '🌱';
case 'medium': return '🌟';
case 'high': return '🔥';
default: return '';
}
};