@fluent-windows/icons
Version:
Fluent-Windows Svg Icons.
44 lines (41 loc) • 1.04 kB
JavaScript
import * as React from 'react';
function createElement(jsx, otherProps = {}) {
const {
type,
props,
children: childrenAttr
} = jsx;
const children = childrenAttr.map(child => child.children.length ? child.children.map((grandchild, index) => {
const grandchildProps = { ...grandchild.props,
key: grandchild.type + index
};
grandchild = { ...grandchild,
props: grandchildProps
};
return createElement(grandchild);
}) : []);
return React.createElement(type, { ...props,
...otherProps
}, ...children);
}
function createIcon(jsx, componentName) {
const Icon = React.forwardRef((props, ref) => {
const style = {
width: '1em',
height: '1em',
display: 'inline-block',
fontSize: 'inherit',
color: 'inherit',
fill: 'currentColor',
verticalAlign: 'middle'
};
return createElement(jsx, {
style,
ref,
...props
});
});
Icon.displayName = `RemixIcon${componentName}`;
return Icon;
}
export default createIcon;