@meistericons/react
Version:
React icon library of meistericons.
41 lines (37 loc) • 1.21 kB
JavaScript
;
/**
* @license @meistericons/react v0.21.1 - ISC
* The source code is licensed under the ISC license.
* See the root directory for the LICENSE file.
*/
import * as React from 'react';
import defaultAttributes from './defaultAttributes.js';
const toCamelCase = (string) => string.replace(
/^([A-Z])|[\s-_]+(\w)/g,
(match, p1, p2) => p2 ? p2.toUpperCase() : p1.toLowerCase()
);
const toPascalCase = (string) => toCamelCase(string).charAt(0).toUpperCase() + toCamelCase(string).slice(1);
const createMeisterIcons = (iconName, iconNode) => {
const Component = React.forwardRef(
({ color = "currentColor", size = 24, children, ...rest }, ref) => React.createElement(
"svg",
{
ref,
width: size,
height: size,
className: `mni mni-${iconName}`,
color,
...defaultAttributes,
...rest
},
[
...iconNode.map(([tag, attrs]) => React.createElement(tag, attrs)),
...Array.isArray(children) ? children : [children]
]
)
);
Component.displayName = toPascalCase(iconName);
return Component;
};
export { createMeisterIcons as default };
//# sourceMappingURL=createMeisterIcons.js.map