Skip to content

Commit

Permalink
Merge pull request #13 from author-more/feat/add-icons
Browse files Browse the repository at this point in the history
feat: add icons - hero, remix, feather
  • Loading branch information
Belar authored Sep 6, 2024
2 parents 8e44db5 + f845c84 commit 56768cd
Show file tree
Hide file tree
Showing 6 changed files with 97 additions and 4 deletions.
23 changes: 23 additions & 0 deletions bin/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,27 @@ export const iconPackages = [
},
iconsDir: "../node_modules/bootstrap-icons/icons",
},
...[
["outline", "24/outline"],
["solid", "24/solid"],
["mini", "20/solid"],
["micro", "16/solid"],
].map(([variant, path]) => ({
id: `heroicons`,
variant,
iconsDir: `../node_modules/heroicons/${path}`,
})),
{
id: "remixicon",
getVariantFromIconName: (iconName: string) => {
if (iconName.endsWith("fill")) return "fill";
return "regular";
},
iconsDir: "../node_modules/remixicon/icons",
},
{
id: "feather",
variant: "regular",
iconsDir: "../node_modules/feather-icons/dist/icons",
},
];
2 changes: 1 addition & 1 deletion bin/files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export const __dirname = import.meta.dirname;

export function getFilesByExtension(directory: string, extension: string) {
const path = resolve(__dirname, directory);
const files = readdirSync(path);
const files = readdirSync(path, { encoding: "utf8", recursive: true });

return files.filter((file) => extname(file) === extension);
}
Expand Down
2 changes: 1 addition & 1 deletion bin/generateIconSets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ iconPackages.forEach(
throw new Error(`Failed to parse the SVG: ${file}`);
}

const iconName = file.replace(".svg", "");
const iconName = file.split("/").pop()!.replace(".svg", "");
const variantName =
variant ?? getVariantFromIconName?.(iconName) ?? "regular";

Expand Down
39 changes: 38 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,14 @@
"@penpot/plugin-styles": "^0.10.0",
"@phosphor-icons/core": "^2.1.1",
"bootstrap-icons": "^1.11.3",
"feather-icons": "^4.29.2",
"heroicons": "^2.1.5",
"iconoir": "^7.8.0",
"lucide-react": "^0.427.0",
"lucide-static": "^0.427.0",
"react": "^18.3.1",
"react-dom": "^18.3.1"
"react-dom": "^18.3.1",
"remixicon": "^4.3.0"
},
"devDependencies": {
"@penpot/plugin-types": "^0.10.0",
Expand Down
30 changes: 30 additions & 0 deletions src/icons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,36 @@ export const iconLibraries: IconLibrary[] = [
},
icons: generateVariants("bootstrap", ["regular", "fill"]),
},
{
id: "heroicons",
name: "Heroicons",
website: "https://heroicons.com",
license: {
name: "MIT",
url: "https://github.com/tailwindlabs/heroicons/blob/master/LICENSE",
},
icons: generateVariants("heroicons", ["outline", "solid", "mini", "micro"]),
},
{
id: "remixicon",
name: "Remix Icon",
website: "https://remixicon.com/",
license: {
name: "Apache-2.0",
url: "https://github.com/Remix-Design/remixicon/blob/master/License",
},
icons: generateVariants("remixicon", ["regular", "fill"]),
},
{
id: "feather",
name: "Feather",
website: "https://feathericons.com/",
license: {
name: "MIT",
url: "https://github.com/feathericons/feather/blob/main/LICENSE",
},
icons: generateVariants("feather", ["regular"]),
},
];

export const defaultIconSetSettings: Record<string, IconSetSettings> =
Expand Down

0 comments on commit 56768cd

Please sign in to comment.