aboutsummaryrefslogtreecommitdiff
path: root/apps/website/src/components/icons/Icon.astro
diff options
context:
space:
mode:
authorLynithDev <61880709+LynithDev@users.noreply.github.com>2023-12-26 20:29:16 +0100
committerLynithDev <61880709+LynithDev@users.noreply.github.com>2023-12-26 20:29:16 +0100
commit530634fea254c344684d42fe7a1d5b4020f6a3ab (patch)
treebeff3954c244bb2c89245a63d984fdea7c338659 /apps/website/src/components/icons/Icon.astro
parent542fb33102902fd7461bee0c0ca8ab4d9ef58de0 (diff)
downloadNexus-530634fea254c344684d42fe7a1d5b4020f6a3ab.tar.gz
Nexus-530634fea254c344684d42fe7a1d5b4020f6a3ab.tar.bz2
Nexus-530634fea254c344684d42fe7a1d5b4020f6a3ab.zip
Footer + small tweaks
Diffstat (limited to 'apps/website/src/components/icons/Icon.astro')
-rw-r--r--apps/website/src/components/icons/Icon.astro21
1 files changed, 17 insertions, 4 deletions
diff --git a/apps/website/src/components/icons/Icon.astro b/apps/website/src/components/icons/Icon.astro
index b9a9b34..858b605 100644
--- a/apps/website/src/components/icons/Icon.astro
+++ b/apps/website/src/components/icons/Icon.astro
@@ -1,6 +1,7 @@
---
import type { HTMLAttributes } from 'astro/types';
import { parse } from 'node-html-parser';
+import Test from "./impl/book-open.svg";
type _ModIcons =
| 'chatting'
@@ -12,21 +13,32 @@ type _ModIcons =
| 'polyweather'
| 'keystrokes';
export type ModIcons = _ModIcons; // bypass for Astro compiler issue https://github.com/withastro/compiler/issues/554#issuecomment-1741702411
+
+type _External =
+ | 'discord'
+ | 'github'
+ | 'youtube'
+ | 'twitter';
+
+export type External = _External;
+
type _Icons =
| 'chevron-down'
| 'download'
| 'book-open'
| 'link-external'
+ | External
| ModIcons;
export type Icons = _Icons; // bypass for Astro compiler issue https://github.com/withastro/compiler/issues/554#issuecomment-1741702411
interface Props extends HTMLAttributes<'svg'> {
- icon: Icons
+ icon: Icons,
+ path?: string,
size?: number | [number, number]
}
-async function getSVG(name: string) {
- const file = await import(/* @vite-ignore */ `./impl/${name}.svg?raw`);
+async function getSVG(name: string, path = 'impl') {
+ const file = await import(`./${path}/${name}.svg?raw`);
if (!file)
throw new Error(`${name} not found`);
@@ -49,6 +61,7 @@ async function getSVG(name: string) {
const {
icon,
size,
+ path = 'impl',
...attributes
} = Astro.props as Props;
@@ -73,7 +86,7 @@ try {
};
};
- const { attributes: baseAttributes, innerHTML } = await getSVG(icon);
+ const { attributes: baseAttributes, innerHTML } = await getSVG(icon, path);
svgAttributes = {
...baseAttributes,
...attributes,