Allow children in React and Preact icons

This commit is contained in:
MoltenCoffee
2022-01-24 14:50:48 +01:00
parent afe378e304
commit 97fdd01470
2 changed files with 5 additions and 5 deletions
@@ -14,7 +14,7 @@ export const toKebabCase = string => string.replace(/([a-z0-9])([A-Z])/g, '$1-$2
export default (iconName, iconNode) => {
const Component = forwardRef(
({ color = 'currentColor', size = 24, strokeWidth = 2, ...rest }, ref) =>
({ color = 'currentColor', size = 24, strokeWidth = 2, children, ...rest }, ref) =>
createElement(
'svg',
{
@@ -27,7 +27,7 @@ export default (iconName, iconNode) => {
className: `lucide lucide-${toKebabCase(iconName)}`,
...rest,
},
iconNode.map(([tag, attrs]) => createElement(tag, attrs)),
[...iconNode.map(([tag, attrs]) => createElement(tag, attrs)), ...(children || [])],
),
);