import { classNames } from '@/lib/components/classNames'; import type { ReactNode, SVGProps } from 'react'; import styles from './Icon.module.css'; export const approvedIconNames = [ 'arrow-back', 'arrow-forward', 'calendar', 'car', 'check', 'chevron-down', 'chevron-forward', 'close', 'error', 'external', 'globe', 'info', 'menu', 'minus', 'plus', 'search', 'settings', 'spinner', 'warning', ] as const; export type ApprovedIconName = (typeof approvedIconNames)[number]; export type IconSize = 'sm' | 'md' | 'lg'; export type IconDirectionBehavior = 'fixed' | 'mirror'; interface IconProps extends Omit, 'name'> { name: ApprovedIconName; size?: IconSize; decorative?: boolean; label?: string; directionBehavior?: IconDirectionBehavior; } const paths: Record = { 'arrow-back': , 'arrow-forward': , calendar: ( <> ), car: ( <> ), check: , 'chevron-down': , 'chevron-forward': , close: , error: ( <> ), external: ( <> ), globe: ( <> ), info: ( <> ), menu: , minus: , plus: , search: ( <> ), settings: ( <> ), spinner: , warning: ( <> ), }; export function Icon({ name, size = 'md', decorative = true, label, directionBehavior = 'fixed', className, ...props }: IconProps) { const accessibleProps = decorative ? ({ 'aria-hidden': true } as const) : ({ role: 'img', 'aria-label': label ?? name } as const); return ( {paths[name]} ); }