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 | import { type SvgIconElement } from '@allshares/studio-design-system'; import { formatIcons, propertyIcons } from '@amalia/amalia-lang/tokens/components'; import { type FormatsEnum, type Property, type PropertyRef } from '@amalia/data-capture/fields/types'; export const formatToIcon = Object.entries(formatIcons).reduce( (acc, [key, Icon]) => { acc[key as FormatsEnum] = <Icon />; return acc; }, {} as Record<FormatsEnum, SvgIconElement>, ); export const propertyRefToIcon = Object.entries(propertyIcons).reduce( (acc, [key, Icon]) => { acc[key as PropertyRef] = <Icon />; return acc; }, {} as Record<PropertyRef, SvgIconElement>, ); export const getPropertyIcon = ({ format, ref }: Partial<Pick<Property, 'format' | 'ref'>>) => ref ? propertyRefToIcon[ref] : format ? formatToIcon[format] : undefined; |