1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
| import { generate } from './utils'
| import type { AbstractNode } from './utils'
|
| export type IconData = {
| name: string
| icon: AbstractNode
| }
|
| export type IconBaseProps = {
| data: IconData
| className?: string
| onClick?: React.MouseEventHandler<SVGElement>
| style?: React.CSSProperties
| }
|
| const IconBase = (
| {
| ref,
| ...props
| }: IconBaseProps & {
| ref?: React.RefObject<React.MutableRefObject<HTMLOrSVGElement>>;
| },
| ) => {
| const { data, className, onClick, style, ...restProps } = props
|
| return generate(data.icon, `svg-${data.name}`, {
| className,
| onClick,
| style,
| 'data-icon': data.name,
| 'aria-hidden': 'true',
| ...restProps,
| 'ref': ref,
| })
| }
|
| IconBase.displayName = 'IconBase'
|
| export default IconBase
|
|