Refactor navbar
- Added `alt` text to `<img/>` tags. - No longer using a loop since there are not many entries. This also simplifies customizing each item.
This commit is contained in:
parent
10eca1d583
commit
19325bb610
5 changed files with 43 additions and 19 deletions
|
@ -1,6 +1,4 @@
|
||||||
export default function({ nav }) {
|
export default function() {
|
||||||
const defaultIcon = "https://static.fosterhangdaan.com/icons/tabler-icons/latest/svg/question-mark.svg";
|
|
||||||
|
|
||||||
const iconStyle = {
|
const iconStyle = {
|
||||||
filter: "var(--filter-green)",
|
filter: "var(--filter-green)",
|
||||||
};
|
};
|
||||||
|
@ -9,25 +7,55 @@ export default function({ nav }) {
|
||||||
<nav className="navbar">
|
<nav className="navbar">
|
||||||
<ul className="navbar-list">
|
<ul className="navbar-list">
|
||||||
<li className="navbar-list-item home">
|
<li className="navbar-list-item home">
|
||||||
<a href="/">
|
<a href="/" title="Home">
|
||||||
<img
|
<img
|
||||||
src="https://static.fosterhangdaan.com/icons/tabler-icons/latest/svg/home.svg"
|
src="https://static.fosterhangdaan.com/icons/tabler-icons/latest/svg/home.svg"
|
||||||
className="icon"
|
className="icon"
|
||||||
style={iconStyle}
|
style={iconStyle}
|
||||||
|
alt="home"
|
||||||
/>
|
/>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
{nav.menu().children.map(navItem => (
|
|
||||||
<li className="navbar-list-item">
|
<li className="navbar-list-item">
|
||||||
<a href={`/${navItem.slug}`} title={navItem.data.title}>
|
<a href="/about" title="About">
|
||||||
<img
|
<img
|
||||||
src={navItem.data.nav_icon || defaultIcon}
|
src="https://static.fosterhangdaan.com/icons/tabler-icons/latest/svg/world-www.svg"
|
||||||
className="icon"
|
className="icon"
|
||||||
style={iconStyle}
|
style={iconStyle}
|
||||||
|
alt="about"
|
||||||
|
/>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li className="navbar-list-item">
|
||||||
|
<a href="/blog" title="Blog">
|
||||||
|
<img
|
||||||
|
src="https://static.fosterhangdaan.com/icons/tabler-icons/latest/svg/news.svg"
|
||||||
|
className="icon"
|
||||||
|
style={iconStyle}
|
||||||
|
alt="blog"
|
||||||
|
/>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li className="navbar-list-item">
|
||||||
|
<a href="/gpg-key" title="GPG Key">
|
||||||
|
<img
|
||||||
|
src="https://static.fosterhangdaan.com/icons/tabler-icons/latest/svg/key.svg"
|
||||||
|
className="icon"
|
||||||
|
style={iconStyle}
|
||||||
|
alt="gpg key"
|
||||||
|
/>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li className="navbar-list-item">
|
||||||
|
<a href="/resume" title="Resume">
|
||||||
|
<img
|
||||||
|
src="https://static.fosterhangdaan.com/icons/tabler-icons/latest/svg/file-cv.svg"
|
||||||
|
className="icon"
|
||||||
|
style={iconStyle}
|
||||||
|
alt="resume"
|
||||||
/>
|
/>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
))}
|
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
);
|
);
|
||||||
|
|
1
about.md
1
about.md
|
@ -1,7 +1,6 @@
|
||||||
---
|
---
|
||||||
title: About
|
title: About
|
||||||
description: About this website and credits where credit is due.
|
description: About this website and credits where credit is due.
|
||||||
nav_icon: https://static.fosterhangdaan.com/icons/tabler-icons/latest/svg/world-www.svg
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## About this site
|
## About this site
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
export const title = "Blog";
|
export const title = "Blog";
|
||||||
export const description = "Hello, my friend. Stay a while and listen.";
|
export const description = "Hello, my friend. Stay a while and listen.";
|
||||||
export const nav_icon = "https://static.fosterhangdaan.com/icons/tabler-icons/latest/svg/news.svg";
|
|
||||||
|
|
||||||
export default function({ nav }) {
|
export default function({ nav }) {
|
||||||
const sortPosts = (a,b) => {
|
const sortPosts = (a,b) => {
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
---
|
---
|
||||||
title: GPG Key
|
title: GPG Key
|
||||||
description: Information about my public GPG key and how to obtain it.
|
description: Information about my public GPG key and how to obtain it.
|
||||||
nav_icon: https://static.fosterhangdaan.com/icons/tabler-icons/latest/svg/key.svg
|
|
||||||
---
|
---
|
||||||
|
|
||||||
> I do not use keyservers. This is the only place where I provide my public key. A key claiming to be mine somewhere else is definitely a fake.
|
> I do not use keyservers. This is the only place where I provide my public key. A key claiming to be mine somewhere else is definitely a fake.
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
---
|
---
|
||||||
title: Resume
|
title: Resume
|
||||||
description: My experience, skills, education, etc.
|
description: My experience, skills, education, etc.
|
||||||
nav_icon: https://static.fosterhangdaan.com/icons/tabler-icons/latest/svg/file-cv.svg
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Experience
|
## Experience
|
||||||
|
|
Loading…
Add table
Reference in a new issue