Skip to content

Commit

Permalink
feat: sticky navbar
Browse files Browse the repository at this point in the history
birthday update!!
  • Loading branch information
soopyc committed Dec 25, 2023
1 parent 058f4d1 commit 7ee92f1
Showing 1 changed file with 25 additions and 15 deletions.
40 changes: 25 additions & 15 deletions src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
</svelte:head>

<div id="loadingBar" style:width={`${navprogress}%`} class:active={showProgress} />
<!-- possible to set to active on startup, but need to find way to animate. -->

<noscript>
<div id="nojs">
Expand All @@ -78,20 +77,23 @@
</div>
</noscript>

<div id="header">
<p id="site-name">soopy.moe<sup>★</sup></p>
<p id="time-display">
{#if !browser}<abbr title="Rendered at">r=</abbr>{/if}{timeDisplay}
</p>
</div>

<div id="nav">
<a href="/" class:current={$page.url.pathname == "/"}>~/Home</a>
<a href="/services" class:current={$page.url.pathname == "/services"}>~/Services</a>
<a href="/projects" class:current={$page.url.pathname == "/projects"}>~/Projects</a>
<a href="/about" class:current={$page.url.pathname == "/about"}>~/About</a>
</div>
<hr />
<nav class="sticky">
<div>
<div id="header">
<p id="site-name">soopy.moe<sup>★</sup></p>
<p id="time-display">
{#if !browser}<abbr title="Rendered at">r=</abbr>{/if}{timeDisplay}
</p>
</div>
<div id="nav">
<a href="/" class:current={$page.url.pathname == "/"}>~/Home</a>
<a href="/services" class:current={$page.url.pathname == "/services"}>~/Services</a>
<a href="/projects" class:current={$page.url.pathname == "/projects"}>~/Projects</a>
<a href="/about" class:current={$page.url.pathname == "/about"}>~/About</a>
</div>
<hr />
</div>
</nav>

<div use:twemoji>
<slot />
Expand Down Expand Up @@ -160,6 +162,7 @@
background-color: var(--color-love)
transition-property: width, height
transition-duration: 150ms
z-index: 1
&.active
height: 0.2rem
Expand All @@ -186,4 +189,11 @@
text-align: center
p
margin: 0
nav
background-color: var(--color-base)
.sticky
position: sticky
top: 0
</style>

0 comments on commit 7ee92f1

Please sign in to comment.