aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpml68 <tutorialmester@gmail.com>2024-02-27 18:42:16 +0100
committerpml68 <tutorialmester@gmail.com>2024-02-27 18:42:16 +0100
commit827732223f4b3fb2fb0769e68eada6dd1a8a94ac (patch)
tree630a11e41a5f3a282268e4faebc32f075061a993
parentfeat: drop Font Awesome, migrate to SVG icons (diff)
downloadpml68.dev-827732223f4b3fb2fb0769e68eada6dd1a8a94ac.tar.gz
fix: icons not displaying in build
-rw-r--r--package.json2
-rw-r--r--src/lib/socials.json10
-rw-r--r--src/routes/+page.svelte12
3 files changed, 13 insertions, 11 deletions
diff --git a/package.json b/package.json
index 3d2319b..a81c47e 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "website",
- "version": "1.0.0",
+ "version": "1.0.1",
"description": "My personal website, built with SvelteKit",
"author": "pml68",
"license": "GPL-3.0",
diff --git a/src/lib/socials.json b/src/lib/socials.json
index 208a115..16ebb5f 100644
--- a/src/lib/socials.json
+++ b/src/lib/socials.json
@@ -2,23 +2,23 @@
"socials": [
{
"link": "https://github.com/pml68",
- "icon": "Github"
+ "iconIndex": 0
},
{
"link": "https://dev.to/pml68",
- "icon": "Dev"
+ "iconIndex": 1
},
{
"link": "https://steamcommunity.com/id/nigmaballs",
- "icon": "Steam"
+ "iconIndex": 2
},
{
"link": "https://t.me/pml68_1",
- "icon": "Telegram"
+ "iconIndex": 3
},
{
"link": "mailto:contact@pml68.me",
- "icon": "Envelope"
+ "iconIndex": 4
}
]
}
diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte
index c6d0eb7..6c403ee 100644
--- a/src/routes/+page.svelte
+++ b/src/routes/+page.svelte
@@ -9,15 +9,17 @@
import TelegramIcon from '$lib/assets/telegram.svg?src'
import EnvelopeIcon from '$lib/assets/envelope.svg?src'
+ const icons: string[] = [SteamIcon, GithubIcon, DevIcon, TelegramIcon, EnvelopeIcon]
+
type Social = {
link: string,
- icon: string
+ iconIndex: number
}
const socialsList: Social[] = socials
- const insertIcon: Function = (element: HTMLElement, icon: string) => {
- element.innerHTML = eval(`${icon}Icon`)
+ const insertIcon: Function = (element: HTMLElement, iconIndex: string) => {
+ element.innerHTML = icons[iconIndex]
}
</script>
@@ -29,8 +31,8 @@
<h1>pml68</h1>
<p>Just your average IT student</p>
<div class="socials">
- {#each socialsList as {link, icon}}
- <a use:insertIcon={icon} href={link} target="_blank" class="icon"></a>
+ {#each socialsList as {link, iconIndex}}
+ <a use:insertIcon={iconIndex} href={link} target="_blank" class="icon"></a>
{/each}
</div>
<div class="projects">