From c2df29c4606ca0505a7877e8565aaf276e22e11e Mon Sep 17 00:00:00 2001 From: codecalm Date: Mon, 23 Jan 2023 18:17:40 +0100 Subject: [PATCH] fix icons css classes --- packages/icons-preact/build.mjs | 3 ++- packages/icons-preact/src/createPreactComponent.js | 4 ++-- packages/icons-react/build.mjs | 2 +- packages/icons-react/src/createReactComponent.js | 4 ++-- packages/icons-solidjs/build.mjs | 2 +- packages/icons-solidjs/src/createSolidComponent.js | 4 ++-- packages/icons-vue/build.mjs | 2 +- packages/icons-vue/src/createVueComponent.js | 2 +- 8 files changed, 12 insertions(+), 11 deletions(-) diff --git a/packages/icons-preact/build.mjs b/packages/icons-preact/build.mjs index 0a11238b7..7ab5eb255 100644 --- a/packages/icons-preact/build.mjs +++ b/packages/icons-preact/build.mjs @@ -3,11 +3,12 @@ import { buildIcons } from '../../.build/build-icons.mjs' const componentTemplate = ({ + name, namePascal, children }) => `\ import createPreactComponent from '../createPreactComponent'; -export default createPreactComponent('${namePascal}', ${JSON.stringify(children)});`; +export default createPreactComponent('${name}', '${namePascal}', ${JSON.stringify(children)});`; const indexItemTemplate = ({ name, diff --git a/packages/icons-preact/src/createPreactComponent.js b/packages/icons-preact/src/createPreactComponent.js index 386e34657..9072dd53f 100644 --- a/packages/icons-preact/src/createPreactComponent.js +++ b/packages/icons-preact/src/createPreactComponent.js @@ -1,7 +1,7 @@ import { h, toChildArray } from 'preact'; import defaultAttributes from './defaultAttributes'; -export default (iconName, iconNode) => { +export default (iconName, iconNamePascal, iconNode) => { const Component = ({ color = 'currentColor', size = 24, strokeWidth = 2, children, ...rest }) => h( 'svg', @@ -17,7 +17,7 @@ export default (iconName, iconNode) => { [...iconNode.map(([tag, attrs]) => h(tag, attrs)), ...toChildArray(children)], ); - Component.displayName = `${iconName}`; + Component.displayName = `${iconNamePascal}`; return Component; }; diff --git a/packages/icons-react/build.mjs b/packages/icons-react/build.mjs index 700c1fc35..6305ede21 100644 --- a/packages/icons-react/build.mjs +++ b/packages/icons-react/build.mjs @@ -8,7 +8,7 @@ const componentTemplate = ({ children }) => `\ import createReactComponent from '../createReactComponent'; -export default createReactComponent('${namePascal}', ${JSON.stringify(children)});`; +export default createReactComponent('${name}', '${namePascal}', ${JSON.stringify(children)});`; const indexItemTemplate = ({ name, diff --git a/packages/icons-react/src/createReactComponent.js b/packages/icons-react/src/createReactComponent.js index 4ebb46ed3..969932c4c 100644 --- a/packages/icons-react/src/createReactComponent.js +++ b/packages/icons-react/src/createReactComponent.js @@ -2,7 +2,7 @@ import { forwardRef, createElement } from 'react'; import PropTypes from 'prop-types'; import defaultAttributes from './defaultAttributes'; -export default (iconName, iconNode) => { +export default (iconName, iconNamePascal, iconNode) => { const Component = forwardRef( ({ color = 'currentColor', size = 24, strokeWidth = 2, children, ...rest }, ref) => createElement( @@ -27,7 +27,7 @@ export default (iconName, iconNode) => { strokeWidth: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), }; - Component.displayName = `${iconName}`; + Component.displayName = `${iconNamePascal}`; return Component; }; diff --git a/packages/icons-solidjs/build.mjs b/packages/icons-solidjs/build.mjs index 59e6698ea..e20cf97d2 100644 --- a/packages/icons-solidjs/build.mjs +++ b/packages/icons-solidjs/build.mjs @@ -8,7 +8,7 @@ const componentTemplate = ({ children }) => `\ import createSolidComponent from '../createSolidComponent'; -export default createSolidComponent('${namePascal}', ${JSON.stringify(children)});`; +export default createSolidComponent('${name}', '${namePascal}', ${JSON.stringify(children)});`; const indexItemTemplate = ({ name, diff --git a/packages/icons-solidjs/src/createSolidComponent.js b/packages/icons-solidjs/src/createSolidComponent.js index 501805dae..c3fc23619 100644 --- a/packages/icons-solidjs/src/createSolidComponent.js +++ b/packages/icons-solidjs/src/createSolidComponent.js @@ -2,7 +2,7 @@ import defaultAttributes from './defaultAttributes' import { splitProps } from "solid-js" import h from "solid-js/h"; -const createSolidComponent = (iconName, iconNode) => { +const createSolidComponent = (iconName, iconNamePascal, iconNode) => { const Component = props => { const [localProps, rest] = splitProps(props, [ 'color', @@ -28,7 +28,7 @@ const createSolidComponent = (iconName, iconNode) => { ); }; - Component.displayName = `${iconName}`; + Component.displayName = `${iconNamePascal}`; return Component; } diff --git a/packages/icons-vue/build.mjs b/packages/icons-vue/build.mjs index e788e19ff..911c2fdf4 100644 --- a/packages/icons-vue/build.mjs +++ b/packages/icons-vue/build.mjs @@ -8,7 +8,7 @@ const componentTemplate = ({ children }) => `\ import createVueComponent from '../createVueComponent'; -export default createVueComponent('${namePascal}', ${JSON.stringify(children)});`; +export default createVueComponent('${name}', '${namePascal}', ${JSON.stringify(children)});`; const indexItemTemplate = ({ name, diff --git a/packages/icons-vue/src/createVueComponent.js b/packages/icons-vue/src/createVueComponent.js index 56ce045e8..c9c3ad3ee 100644 --- a/packages/icons-vue/src/createVueComponent.js +++ b/packages/icons-vue/src/createVueComponent.js @@ -1,7 +1,7 @@ import { h } from 'vue'; import defaultAttributes from './defaultAttributes'; -const createVueComponent = (iconName, iconNode) => ( +const createVueComponent = (iconName, iconNamePascal, iconNode) => ( { size, color, ...props }, { attrs, slots } ) => {