21 lines
424 B
TypeScript
21 lines
424 B
TypeScript
import * as React from 'react';
|
|
import * as Icons from '@assets/shared/icon/components/index';
|
|
import { IconType } from './types'
|
|
|
|
type Props = {
|
|
icon: IconType;
|
|
} & React.HTMLProps<HTMLElement>;
|
|
|
|
export function Icon({ icon, ...props }: Props) {
|
|
const Component = React.createElement(Icons[icon])
|
|
|
|
return (
|
|
<i
|
|
className="c-icon"
|
|
{...props}
|
|
>
|
|
{ Component }
|
|
</i>
|
|
);
|
|
}
|