Add "icon" class to generated icons

This commit is contained in:
venashial
2022-05-24 21:39:49 -07:00
parent a02e2e1fa1
commit 92cee2321f
3 changed files with 15 additions and 5 deletions

View File

@@ -49,6 +49,8 @@
<a class={className} {href} {disabled} {title} {target} on:click>
<slot />
</a>
{:else if as === 'input'}
<input class={className} {value} {disabled} {title} on:click />
{:else}
<svelte:element this={as} class={className} {disabled} {title} on:click>
<slot />

View File

@@ -42,13 +42,16 @@ export default function Generator(options) {
) {
return;
}
if (options.landingPage) await landingPage(API_URL);
if (options.projectColors) await projectColors(API_URL);
if (options.gameVersions) await gameVersions(API_URL);
if (options.tags) await tags(API_URL);
if (options.landingPage) await landingPage(API_URL);
if (options.gameVersions) await gameVersions(API_URL);
if (options.projectColors) await projectColors(API_URL);
// Write new state
state.lastGenerated = new Date().toISOString();
state.options = options;
await fs.writeFile('./generated/state.json', JSON.stringify(state, null, 2));
},
};

View File

@@ -19,10 +19,15 @@ export async function tags(API_URL) {
]);
progressBar.update(4);
const tagIconReducer = (a, v) => ({
...a,
[v.name]: v.icon.replace('<svg', '<svg class="icon"'),
});
// Create single object with icons
const tagIcons = {
...categories.reduce((a, v) => ({ ...a, [v.name]: v.icon }), {}),
...loaders.reduce((a, v) => ({ ...a, [v.name]: v.icon }), {}),
...categories.reduce(tagIconReducer, {}),
...loaders.reduce(tagIconReducer, {}),
};
progressBar.increment();