Skip to content

Commit

Permalink
feat(IconsUI/ReactUI): ProviderIcons removal from Design System
Browse files Browse the repository at this point in the history
  • Loading branch information
male-gal committed Aug 29, 2023
1 parent 1a3205b commit 41a38e9
Show file tree
Hide file tree
Showing 76 changed files with 7 additions and 1,129 deletions.
6 changes: 6 additions & 0 deletions .changeset/small-fishes-flow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@ledgerhq/icons-ui": patch
"@ledgerhq/react-ui": patch
---

Removal of ProviderIcons from UILib
75 changes: 0 additions & 75 deletions libs/ui/packages/icons/scripts/buildLegacy.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const svgr = require("@svgr/core").default;
const rootDir = path.join(__dirname, "..", "src");
const reactDir = path.join(rootDir, "reactLegacy");
const nativeDir = path.join(rootDir, "nativeLegacy");
const additionalIconsDir = path.join(__dirname, "..", "src", "additionalIcons");

// Create folders if needed
if (!fs.existsSync(reactDir)) {
Expand Down Expand Up @@ -67,31 +66,6 @@ function reactTemplate({ template }, _, { imports, interfaces, componentName, __
`;
}

// Additional Icons component template
function reactAdditionalTemplate(
{ template },
_,
{ imports, interfaces, componentName, __, jsx, exports },
) {
const plugins = ["typescript"];
const tpl = template.smart({ plugins });

return tpl.ast`
${imports}
import Svg from "../StyledSvg"
type Props = { size?: number | string; width?: number | string; height?: number | string; };
${interfaces}
function ${componentName} ({ size, width, height }: Props): JSX.Element {
return ${jsx};
}
${exports}
`;
}

// Component template
function reactNativeTemplate(
{ template },
Expand Down Expand Up @@ -234,52 +208,3 @@ glob(`${rootDir}/svg-legacy/**/*.svg`, (err, icons) => {
}
});
});
//====== create additional icons =====

// get subfolders
const folders = fs.readdirSync(additionalIconsDir);

folders.forEach(folder => {
// Create target folders
const folderName = `${folder}`;
if (!fs.existsSync(`${reactDir}/${folderName}`)) {
fs.mkdirSync(`${reactDir}/${folderName}`);
}

fs.writeFileSync(`${reactDir}/${folderName}/index.ts`, "", {
flag: "w",
encoding: "utf-8",
});

glob(`${additionalIconsDir}/${folder}/*.svg`, (err, icons) => {
icons.forEach(icon => {
let name = camelcase(path.basename(icon, ".svg"), { pascalCase: true });
if (!isNaN(name.charAt(0))) name = `_${name}`; // fix variable name leading with a numerical value

const exportString = `export { default as ${name} } from "./${name}";\n`;
fs.appendFileSync(`${reactDir}/${folderName}/index.ts`, exportString, "utf-8");

const svg = fs.readFileSync(icon, "utf-8");

const options = {
plugins: ["@svgr/plugin-svgo", "@svgr/plugin-jsx"],
expandProps: false,
componentName: name,
svgProps: {
height: "{height || size}",
width: "{width || size}",
},
svgoConfig: {
plugins: [{ removeXMLNS: true, removeViewBox: false }],
},
};
convert(
svg,
{ ...options, template: reactAdditionalTemplate },
{ componentName: name },
`${reactDir}/${folderName}/${name}.tsx`,
true,
);
});
});
});
3 changes: 0 additions & 3 deletions libs/ui/packages/icons/src/additionalIcons/Providers/AAVE.svg

This file was deleted.

This file was deleted.

10 changes: 0 additions & 10 deletions libs/ui/packages/icons/src/additionalIcons/Providers/Baanx.svg

This file was deleted.

17 changes: 0 additions & 17 deletions libs/ui/packages/icons/src/additionalIcons/Providers/Binance.svg

This file was deleted.

11 changes: 0 additions & 11 deletions libs/ui/packages/icons/src/additionalIcons/Providers/CIC.svg

This file was deleted.

This file was deleted.

19 changes: 0 additions & 19 deletions libs/ui/packages/icons/src/additionalIcons/Providers/CoinGecko.svg

This file was deleted.

Loading

0 comments on commit 41a38e9

Please sign in to comment.