From 827732223f4b3fb2fb0769e68eada6dd1a8a94ac Mon Sep 17 00:00:00 2001
From: pml68 <tutorialmester@gmail.com>
Date: Tue, 27 Feb 2024 18:42:16 +0100
Subject: fix: icons not displaying in build

---
 src/routes/+page.svelte | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

(limited to 'src/routes/+page.svelte')

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">
-- 
cgit v1.2.3

