Icon

Компонент для отображения иконок

See:

Props

icon

  • type: Icon
  • required: true

В качестве иконки можно передавать как объект, так и строку в соответствии с типами

export type { IconDefinition as FaIconDefinition } from '@fortawesome/fontawesome-common-types';

export enum FA_ICON_PREFIXES {
  SOLID = 'fas',
  LIGHT = 'fal',
  BRAND = 'fab',
  REGULAR = 'far',
  DUOTONE = 'fad',
  THIN = 'fat',
  SHARP_SOLID = 'fass',
  SHARP_REGULAR = 'fasr',
  SHARP_LIGHT = 'fasl',
  KIT = 'fak',
}

export enum CUSTOM_ICON_PREFIXES {
  EDU = 'edu',
}

export type IconPrefix = `${FA_ICON_PREFIXES | CUSTOM_ICON_PREFIXES}`;

export type IconLiteral = `${IconPrefix}/${string}`;

export const ICON_PREFIXES = [
  ...Object.values(FA_ICON_PREFIXES),
  ...Object.values(CUSTOM_ICON_PREFIXES),
] as const;

export interface IconNode {
  tag: string;
  attrs?: Record<string, any>;
  children?: IconNode[];
}
export type RootIconNode = Required<Pick<IconNode, 'children'>> &
  Pick<IconNode, 'attrs'>;

export interface IconLookup {
  prefix: IconPrefix;
  iconName: string;
}

export interface IconDefinition extends IconLookup, RootIconNode {}

export type IconRenderer<N> = (
  tag: string,
  attrs: Record<string, any>,
  children: N[],
) => N;

export type Icons = Record<IconPrefix, Record<string, IconDefinition>>;

@example 'far/user'@example 'edu/studwork-logo'@example img/hat.svg@example ['far', 'user']@example { prefix: 'far', iconName: 'user' }@example { attrs: { viewBox: '0 0 10 10' }, children: [ { attrs: { d: '' } } ] }

spin

  • type: boolean

Спин анимация для pending