From 91f8c1834a8609b2d57c4afc94fc93ec38d8f8ca Mon Sep 17 00:00:00 2001 From: Firq Date: Fri, 29 Dec 2023 22:57:30 +0100 Subject: [PATCH 1/2] Migrating to iconoir imports --- src/components/navbar.astro | 27 +++++++++++++++------------ src/components/navbarEntry.astro | 25 ++++++++++++++++++++++--- src/layouts/Layout.astro | 28 +++++++++++++++++++++++++--- static/data/_navdata.json | 10 +++++----- 4 files changed, 67 insertions(+), 23 deletions(-) diff --git a/src/components/navbar.astro b/src/components/navbar.astro index d4a6971..7c9213f 100644 --- a/src/components/navbar.astro +++ b/src/components/navbar.astro @@ -1,6 +1,8 @@ --- import { Image } from 'astro:assets'; import logo from '../assets/logo.svg' +import hamburger from 'iconoir/icons/menu.svg' +const hamburger_src_url = `url("${hamburger.src}")`; ---
@@ -15,11 +17,11 @@ import logo from '../assets/logo.svg'
- +
- diff --git a/src/layouts/Layout.astro b/src/layouts/Layout.astro index 75ab12e..ec27520 100644 --- a/src/layouts/Layout.astro +++ b/src/layouts/Layout.astro @@ -3,7 +3,12 @@ import Navbar from '../components/navbar.astro' import NavbarEntry from '../components/navbarEntry.astro' import navdata from '../../static/data/_navdata.json' import embed from '../assets/embed.png' -import "iconoir/css/iconoir.css" + +import home from 'iconoir/icons/home.svg' +import servants from 'iconoir/icons/task-list.svg' +import ta_collection from 'iconoir/icons/database.svg' +import blog from 'iconoir/icons/bookmark-book.svg' +import about from 'iconoir/icons/mail.svg' export interface Props { title: string @@ -11,6 +16,18 @@ export interface Props { descriptionOverride?: string } +interface IconsLookup { + [key: string]: ImageMetadata +} + +const icons: IconsLookup = { + home: home, + servants: servants, + ta_collection: ta_collection, + blog: blog, + about: about, +} + const { descriptionOverride, currentpage, title } = Astro.props let description @@ -24,9 +41,14 @@ let currPage = 'https://firq.dev/' if (currentpage !== 'home') { currPage += currentpage } + +const mapped_navdata = navdata.map((item) => ({ + ...item, + ...{ icon: icons[item.icon] }, +})) --- - + {title} @@ -54,7 +76,7 @@ if (currentpage !== 'home') { { - navdata.map((item) => ( + mapped_navdata.map((item) => ( )) } diff --git a/static/data/_navdata.json b/static/data/_navdata.json index bf03d7f..9397c84 100644 --- a/static/data/_navdata.json +++ b/static/data/_navdata.json @@ -2,26 +2,26 @@ { "link": "/", "text": "Home", - "icon": "iconoir-home" + "icon": "home" }, { "link": "/servants", "text": "Servants", - "icon": "iconoir-task-list" + "icon": "servants" }, { "link": "/ta-collection", "text": "TA Collection", - "icon": "iconoir-database" + "icon": "ta_collection" }, { "link": "/blog", "text": "Blog", - "icon": "iconoir-bookmark-book" + "icon": "blog" }, { "link": "/about", "text": "About", - "icon": "iconoir-mail" + "icon": "about" } ] \ No newline at end of file From a24a7af3d8c6889b10a3acaa18937f552e144a54 Mon Sep 17 00:00:00 2001 From: Firq Date: Fri, 29 Dec 2023 23:10:24 +0100 Subject: [PATCH 2/2] Bumped version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0ec1f43..3808975 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@firq/fgosite", "type": "module", - "version": "0.1.16", + "version": "0.1.17", "private": true, "scripts": { "dev": "astro dev",