mirror of
https://github.com/lucide-icons/lucide.git
synced 2026-11-14 13:58:21 +00:00
29 lines
765 B
JavaScript
29 lines
765 B
JavaScript
import { forwardRef, createElement } from 'react';
|
|
import PropTypes from 'prop-types';
|
|
|
|
export default (iconName, [tag, attrs, children]) => {
|
|
const Component = forwardRef(({ color = 'currentColor', size = 24, width = 2, ...rest }, ref) =>
|
|
createElement(
|
|
tag,
|
|
{
|
|
ref,
|
|
...attrs,
|
|
width: size,
|
|
height: size,
|
|
color,
|
|
strokeWidth: width,
|
|
...rest,
|
|
},
|
|
children.map(([childTag, childAttrs]) => createElement(childTag, childAttrs)),
|
|
),
|
|
);
|
|
|
|
Component.propTypes = {
|
|
color: PropTypes.string,
|
|
size: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
};
|
|
|
|
Component.displayName = `${iconName}`;
|
|
};
|