From d6a00ded47bc65919e4f1157637a9b6080f46d5d Mon Sep 17 00:00:00 2001 From: Maxi Ferreira Date: Tue, 30 Nov 2021 16:39:37 -0800 Subject: [PATCH] Highlight current in menu --- TODO | 5 +++-- src/components/Header.astro | 4 ++-- src/components/Nav.astro | 10 +++++----- src/layouts/BaseLayout.astro | 5 +++-- src/layouts/BlogPostLayout.astro | 2 +- src/pages/about.astro | 4 +--- src/pages/blog/index.astro | 2 +- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/TODO b/TODO index 6c42d35..83d17f8 100644 --- a/TODO +++ b/TODO @@ -1,8 +1,9 @@ [ ] Update README [ ] Install Fonts [ ] Style Code blocks -[ ] Highlight current navigation item +[x] Highlight current navigation item [ ] Use css variables [ ] Dark mode -[ ] Resize Logo +[x] Resize Logo [ ] Reading time +[x] Bio component diff --git a/src/components/Header.astro b/src/components/Header.astro index d95a500..b9951d8 100644 --- a/src/components/Header.astro +++ b/src/components/Header.astro @@ -2,7 +2,7 @@ import Logo from './Logo.astro' import Nav from './Nav.astro' -// TODO: Pass current page to Nav +const { current = '' } = Astro.props; --- diff --git a/src/layouts/BaseLayout.astro b/src/layouts/BaseLayout.astro index 5e5761d..be6cd50 100644 --- a/src/layouts/BaseLayout.astro +++ b/src/layouts/BaseLayout.astro @@ -7,8 +7,9 @@ export interface Props { title: string; description: string; permalink: string; + current?: string; } -const { title, description, permalink } = Astro.props; +const { title, description, permalink, current } = Astro.props; --- @@ -16,7 +17,7 @@ const { title, description, permalink } = Astro.props;
-
+
diff --git a/src/layouts/BlogPostLayout.astro b/src/layouts/BlogPostLayout.astro index 2ae8b42..d6a3542 100644 --- a/src/layouts/BlogPostLayout.astro +++ b/src/layouts/BlogPostLayout.astro @@ -6,7 +6,7 @@ const {content} = Astro.props; const {title, description, publishDate, author, heroImage, permalink, alt} = content; --- - +

{publishDate} ~ {'TODO: READING TIME'}

{title}

diff --git a/src/pages/about.astro b/src/pages/about.astro index 130fdcd..b7b5e60 100644 --- a/src/pages/about.astro +++ b/src/pages/about.astro @@ -6,12 +6,10 @@ const description = 'About your blog.'; const permalink = 'https://example.com/about'; --- - +

About

- - Illustration of a notebook
Illustration by Icons 8 from Ouch! diff --git a/src/pages/blog/index.astro b/src/pages/blog/index.astro index a3514ee..c24a399 100644 --- a/src/pages/blog/index.astro +++ b/src/pages/blog/index.astro @@ -13,7 +13,7 @@ let allPosts = await Astro.fetchContent('./posts/*.md'); allPosts = allPosts.sort((a, b) => new Date(b.publishDate).valueOf() - new Date(a.publishDate).valueOf()); --- - +

Blog

{allPosts.map((post, index) => (