Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Small Web
henry
Commits
7754a57c
Commit
7754a57c
authored
Apr 21, 2021
by
Aral Balkan
Browse files
Reimplement active links
parent
ea6f8ac0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Navigation.svelte
View file @
7754a57c
<script>
import { signedIn } from './state.js'
import sections from './sections.js'
import { link } from 'svelte-spa-router'
import active from 'svelte-spa-router/active'
function shouldDisplay(section, isSignedIn) {
// Display either the Sign In or Private section based on sign in status.
...
...
@@ -18,6 +20,11 @@
li { display: inline-block; }
li:not(:first-child):before { content: '|'; padding-right: 0.5em;}
li:not(:last-child) { padding-right: 0.5em; }
:global(a.active) {
color: black;
text-decoration: none;
}
</style>
<nav>
...
...
@@ -26,7 +33,7 @@
<!-- Including $signedIn here to trigger reactivity. -->
{#if !section.notInNavigation && shouldDisplay(section, $signedIn)}
<li>
<a href='
/#
{section.path}'>{section.title}</a>
<a href='{section.path}'
use:link use:active
>{section.title}</a>
</li>
{/if}
{/each}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment