Migrating to iconoir imports
This commit is contained in:
parent
719a9ff3de
commit
91f8c1834a
4 changed files with 67 additions and 23 deletions
src/layouts
|
@ -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] },
|
||||
}))
|
||||
---
|
||||
|
||||
<!DOCTYPE html>
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>{title}</title>
|
||||
|
@ -54,7 +76,7 @@ if (currentpage !== 'home') {
|
|||
<body>
|
||||
<Navbar>
|
||||
{
|
||||
navdata.map((item) => (
|
||||
mapped_navdata.map((item) => (
|
||||
<NavbarEntry currentPage={currentpage} {...item} />
|
||||
))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue