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> <a class={className} {href} {disabled} {title} {target} on:click>
<slot /> <slot />
</a> </a>
{:else if as === 'input'}
<input class={className} {value} {disabled} {title} on:click />
{:else} {:else}
<svelte:element this={as} class={className} {disabled} {title} on:click> <svelte:element this={as} class={className} {disabled} {title} on:click>
<slot /> <slot />

View File

@@ -42,13 +42,16 @@ export default function Generator(options) {
) { ) {
return; 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.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 // Write new state
state.lastGenerated = new Date().toISOString(); state.lastGenerated = new Date().toISOString();
state.options = options; state.options = options;
await fs.writeFile('./generated/state.json', JSON.stringify(state, null, 2)); 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); progressBar.update(4);
const tagIconReducer = (a, v) => ({
...a,
[v.name]: v.icon.replace('<svg', '<svg class="icon"'),
});
// Create single object with icons // Create single object with icons
const tagIcons = { const tagIcons = {
...categories.reduce((a, v) => ({ ...a, [v.name]: v.icon }), {}), ...categories.reduce(tagIconReducer, {}),
...loaders.reduce((a, v) => ({ ...a, [v.name]: v.icon }), {}), ...loaders.reduce(tagIconReducer, {}),
}; };
progressBar.increment(); progressBar.increment();