Skip to content
This repository has been archived by the owner on May 24, 2024. It is now read-only.

Commit

Permalink
updated icon scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
sdadn committed May 6, 2024
1 parent 5d2f4a7 commit f704a33
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,18 @@ const generateIconAll = (iconObjs) =>
!iconObj.themeable && !iconObj.deprecated && !iconObj.isOldLowlight
);

staticIcons.sort((a, b) => a.componentName.localeCompare(b.componentName));

outputfile.write(
"// This file is autogenerated from scripts/src/generate-example\n"
);
outputfile.write("/* eslint-disable */\n");
outputfile.write("import React from 'react';\n");
outputfile.write("import {\n");
staticIcons.forEach((iconObj) => {
outputfile.write(iconObj.syntaxImport);
outputfile.write(` ${iconObj.componentName},\n`);
});
outputfile.write("} from 'terra-icon';\n\n");
outputfile.write("const cellStyle = { padding: '0.5rem' };\n");
outputfile.write("const IconAll = () => (\n");
outputfile.write(" <div>");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,20 @@ const generateIconAll = (iconObjs) =>
}
});

themeableIcons.sort((a, b) => a.componentName.localeCompare(b.componentName));

outputfile.write(
"// This file is autogenerated from scripts/src/generate-example\n"
);
outputfile.write("/* eslint-disable */\n");
outputfile.write("import React from 'react';\n");

outputfile.write("import {\n");
themeableIcons.forEach((iconObj) => {
outputfile.write(iconObj.syntaxImport);
outputfile.write(` ${iconObj.componentName},\n`);
});
outputfile.write("} from 'terra-icon';\n\n");

outputfile.write("const cellStyle = { padding: '0.5rem' };\n");
outputfile.write("const IconAll = () => (\n");
outputfile.write(" <div>");
Expand Down
2 changes: 1 addition & 1 deletion packages/terra-icon/scripts/src/icon-utils/parseCsv.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const parseCsv = () => new Promise((resolve) => {
jsonObj.bidi = (jsonObj.bidi === 'bi-directional');
jsonObj.spinner = (jsonObj.name === 'IconSpinner');
jsonObj.syntaxComponent = `<${jsonObj.componentName} height='2em' width='2em' />`;
jsonObj.syntaxImport = `import ${jsonObj.componentName} from 'terra-icon/lib/icon/${jsonObj.componentName}';\n`;
jsonObj.syntaxImport = `import \{ ${jsonObj.componentName} \} from 'terra-icon';\n`;
/* eslint-enable no-param-reassign */
}).then(jsonObj => resolve(jsonObj));
});
Expand Down

0 comments on commit f704a33

Please sign in to comment.