Skip to content

Commit

Permalink
fix(generator): fix file names for Infinity icons
Browse files Browse the repository at this point in the history
  • Loading branch information
duongdev committed Jan 30, 2022
1 parent 4830a43 commit a5e66ef
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
22 changes: 11 additions & 11 deletions generator/generate-svg.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,24 +115,24 @@ const getIconList = () => {

const generateMainIconFile = (icon) => {
const component = Case.pascal(icon);
const componentFileName = fileNameMap[component] || component;
const componentName = componentNameMap[component] || component;
const componentCode = `import React, { useContext, useMemo } from 'react'
import { IconProps, IconContext } from '../lib'
import bold from '../bold/${component}'
import duotone from '../duotone/${component}'
import fill from '../fill/${component}'
import light from '../light/${component}'
import regular from '../regular/${component}'
import thin from '../thin/${component}'
import bold from '../bold/${componentFileName}'
import duotone from '../duotone/${componentFileName}'
import fill from '../fill/${componentFileName}'
import light from '../light/${componentFileName}'
import regular from '../regular/${componentFileName}'
import thin from '../thin/${componentFileName}'
function ${
componentNameMap[component] || component
}({ weight, color, size, style, mirrored }: IconProps) {
function ${componentName}({ weight, color, size, style, mirrored }: IconProps) {
const {
color: contextColor = '#000',
size: contextSize = 24,
weight: contextWeight = 'regular',
mirrored: contextMirrored = false,
mirrored: contextMirrored = false,
style: contextStyle,
} = useContext(IconContext)
Expand Down Expand Up @@ -168,7 +168,7 @@ function ${
)
}
export default ${componentNameMap[component] || component}
export default ${componentName}
`;

const filePath = path.join(__dirname, '../src/icons', `${component}.tsx`);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"example": "yarn --cwd example",
"pods": "cd example && pod-install --quiet",
"bootstrap": "yarn example && yarn && yarn pods",
"format": "prettier --write --fix src/**/*",
"format": "prettier --write src/**/* src/index.tsx",
"generate": "node generator/generate-svg.js"
},
"keywords": [
Expand Down

0 comments on commit a5e66ef

Please sign in to comment.