All files / components MaterialIcon.tsx

33.33% Statements 2/6
0% Branches 0/3
0% Functions 0/1
33.33% Lines 2/6

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 201x         1x                            
import { MaterialSymbol } from 'react-material-symbols'
 
// because typescript
// the real icon list is several thousand long and we'd need to typecheck it with
// SymbolCodepointsArray.find((e) => e === icon)
const MaterialIcon: Record<string, JSX.Element> = {
  demography: (
    <MaterialSymbol icon="demography" weight={400} grade={0} size={24} />
  ),
  lock: <MaterialSymbol icon="lock" weight={400} grade={0} size={24} />,
  mail: <MaterialSymbol icon="mail" weight={400} grade={0} size={24} />,
}
 
export function getIcon(icon?: string) {
  Iif (!icon || !(icon in MaterialIcon)) {
    return <></>
  }
  return MaterialIcon[icon]
}