feat: Site (#1)

* site: pull data from "icons" dir

* site: display icons

* site: remove redundant code

* site: colour mode support

* site: header

* site: order imports

* site: search

* site: add toast when copying icon

* site: styling

* site: hero

* fix: disable theme toggle transitions

* feat: Use Yarn Workspaces

* refactor: Update site deploy scripts

* refactor: Remove dark mode for now

* feat: Add site title

* refactor: Fix warning and format

* feat: Add dark mode back 👀

* feat: Escape key to reset query

* Fix by aelfric

* Add Github link

* Fix #40

Co-authored-by: Eric Fennis <eric.fennis@gmail.com>
This commit is contained in:
John Letey
2020-08-29 22:16:38 +01:00
committed by GitHub
parent 1b726f592a
commit e3e4514dcc
16 changed files with 6674 additions and 20 deletions

View File

@@ -0,0 +1,32 @@
import fs from "fs";
import path from "path";
import tags from '../../../../tags.json';
const directory = path.join(process.cwd(), "../../icons");
export function getAllNames() {
const fileNames = fs.readdirSync(directory);
return fileNames.map((fileName) => {
return fileName.replace(/\.svg$/, "");
});
}
export function getData(name) {
const fullPath = path.join(directory, `${name}.svg`);
const fileContents = fs.readFileSync(fullPath, "utf8");
return {
name,
tags: tags[name] || [],
src: fileContents,
};
}
export function getAllData() {
const names = getAllNames();
return names.map((name) => {
return getData(name);
});
}