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

Commit

Permalink
Update icon example generation scripts (#4098)
Browse files Browse the repository at this point in the history
sdadn authored May 6, 2024
1 parent 5d2f4a7 commit fa6b6e2
Showing 5 changed files with 1,117 additions and 1,097 deletions.

Large diffs are not rendered by default.

1,926 changes: 968 additions & 958 deletions packages/terra-core-docs/src/terra-dev-site/doc/icon/example/IconThemeable.jsx

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -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>");
Original file line number Diff line number Diff line change
@@ -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>");
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
@@ -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));
});

0 comments on commit fa6b6e2

Please sign in to comment.