Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed navigation tab bug #163

Merged
merged 1 commit into from
Oct 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 11 additions & 10 deletions src/lib/components/sections/navbar.svelte
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
<script lang="ts">
export let segment: string;
import { page } from '$app/stores';

let menu: HTMLUListElement;
let checkbox: HTMLInputElement;

const menuItems = [
{ title: 'about', slug: 'about' },
{ title: 'events', slug: 'events' },
{ title: 'paths', slug: 'paths' },
{ title: 'about', path: '/about' },
{ title: 'events', path: '/events' },
{ title: 'paths', path: '/paths' },
{
title: '<span class="headers">node</span>Buds',
slug: 'nodebuds',
path: '/nodebuds',
},
{ title: 'connect', slug: 'connect' },
{ title: 'connect', path: '/connect' },
];

const handleClose = () => {
Expand All @@ -30,14 +31,14 @@
</a>

<ul class="pages" bind:this={menu}>
{#each menuItems as { title, slug } (slug)}
{#each menuItems as { title, path } (path)}
<li>
<a
on:click={() => handleClose()}
href={`/${slug}`}
class="{`page page-${slug}`} headers"
href={path}
class="{`page page-${path.replace(/^\//, "")}`} headers"
rel="prefetch"
aria-current={segment === slug}>
aria-current={path === $page.path }>
{@html title}
</a>
</li>
Expand Down