Files
money.sori.studio/utils/categoryPresentation.ts

30 lines
972 B
TypeScript

export const CATEGORY_ICON_OPTIONS = [
{ value: 'circle', label: '기본', glyph: '●' },
{ value: 'food', label: '식비', glyph: '식' },
{ value: 'shopping', label: '쇼핑', glyph: '쇼' },
{ value: 'home', label: '주거', glyph: '집' },
{ value: 'transport', label: '교통', glyph: '차' },
{ value: 'health', label: '건강', glyph: '건' },
{ value: 'work', label: '근로', glyph: '근' },
{ value: 'salary', label: '급여', glyph: '월' },
{ value: 'gift', label: '기타', glyph: '기' }
]
export const CATEGORY_COLOR_OPTIONS = [
'#ef4444',
'#f97316',
'#eab308',
'#14b8a6',
'#2563eb',
'#8b5cf6',
'#6b7673'
]
export function categoryGlyph(icon?: string | null) {
return CATEGORY_ICON_OPTIONS.find(option => option.value === icon)?.glyph || CATEGORY_ICON_OPTIONS[0].glyph
}
export function categoryColor(color?: string | null) {
return CATEGORY_COLOR_OPTIONS.includes(color || '') ? color! : CATEGORY_COLOR_OPTIONS[6]
}