-
-
Notifications
You must be signed in to change notification settings - Fork 96
/
Copy pathSvgIcon.tsx
26 lines (23 loc) · 811 Bytes
/
SvgIcon.tsx
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
import clsx from 'clsx';
import {JSX, ParentProps, splitProps} from 'solid-js';
import {svgIcon, SvgIconProps as _SvgIconProps} from './SvgIcon.css';
export type SvgIconProps = _SvgIconProps &
ParentProps<JSX.IntrinsicElements['svg']>;
export function SvgIcon(props: SvgIconProps): JSX.Element {
const classes = () => clsx(svgIcon({size: props.size}), props.class);
const [local, others] = splitProps(props, ['class', 'children', 'viewBox']);
return (
// eslint-disable-next-line solid/jsx-no-duplicate-props
<svg
xmlns="http://www.w3.org/2000/svg"
fill="none"
class={classes()}
viewBox={local.viewBox}
// eslint-disable-next-line solid/no-innerhtml
innerHTML={props.innerHTML ?? undefined}
{...others}
>
{props.children}
</svg>
);
}