mirror of
https://github.com/tabler/tabler-icons.git
synced 2025-01-16 20:28:28 +01:00
Add <title> to <svg> in SolidJS (#1156)
Adds <title> child tag & title property in built package, but still doesn't show it on hover. Co-authored-by: Bartłomiej Gawęda <bgaweda@abis.krakow.pl>
This commit is contained in:
parent
c898ade0f0
commit
b6591cec2d
@ -10,13 +10,14 @@ const createSolidComponent = (
|
||||
iconNode: IconNode,
|
||||
) => {
|
||||
const Component = (props: IconProps) => {
|
||||
const [localProps, rest] = splitProps(props, ['color', 'size', 'stroke', 'children', 'class']),
|
||||
const [localProps, rest] = splitProps(props, ['color', 'size', 'stroke', 'title', 'children', 'class']),
|
||||
attributes = defaultAttributes[type];
|
||||
|
||||
const svgProps = {
|
||||
...attributes,
|
||||
width: () => (localProps.size != null ? localProps.size : attributes.width),
|
||||
height: () => (localProps.size != null ? localProps.size : attributes.height),
|
||||
title: () => localProps.title != null ? localProps.title : undefined,
|
||||
...(type === 'filled'
|
||||
? {
|
||||
fill: () => (localProps.color != null ? localProps.color : 'currentColor'),
|
||||
@ -33,7 +34,11 @@ const createSolidComponent = (
|
||||
return h(
|
||||
'svg',
|
||||
[svgProps, rest],
|
||||
[...iconNode.map(([tag, attrs]) => h(tag, attrs)), localProps.children],
|
||||
[
|
||||
localProps.title && h('title', {}, localProps.title),
|
||||
...iconNode.map(([tag, attrs]) => h(tag, attrs)),
|
||||
localProps.children
|
||||
],
|
||||
);
|
||||
};
|
||||
|
||||
|
@ -8,5 +8,6 @@ export interface IconProps extends SVGAttributes {
|
||||
color?: string;
|
||||
size?: string | number;
|
||||
strokeWidth?: string | number;
|
||||
title?: string;
|
||||
class?: string;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user