Skip to content

Commit

Permalink
feat: hide navbar on blog posts to reduce clutter
Browse files Browse the repository at this point in the history
  • Loading branch information
youwen5 committed May 13, 2024
1 parent 9440516 commit 8bc54c7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
23 changes: 18 additions & 5 deletions src/lib/components/Navbar/Navbar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,21 @@
import Button from '../ui/button/button.svelte'
import { Moon, Sun } from 'svelte-radix'
let current: 'blog' | 'about' | 'home' | 'portfolio' | string
let current: 'blogpost' | 'blog' | 'about' | 'home' | 'portfolio' | string
const updateCurrent = () => {
const path = window.location.pathname
if (path === '/') {
current = 'home'
// if (path === '/') {
// current = 'home'
// } else {
// const segments = path.split('/')
// current = segments[1] || 'home'
// }
if (path === '/blog') {
current = 'blog'
} else if (path.startsWith('/blog')) {
current = 'blogpost'
} else {
const segments = path.split('/')
current = segments[1] || 'home'
Expand All @@ -24,10 +33,14 @@
onMount(() => navigating.subscribe(updateCurrent))
</script>

<nav class="h-16 lg:h-24 bg-background bg-opacity-50 backdrop-blur-lg fixed w-full z-40 font-serif">
<nav
class="h-16 lg:h-24 bg-background bg-opacity-50 backdrop-blur-lg md:fixed w-full z-40 font-serif"
class:fixed={current !== 'blogpost'}
class:absolute={current === 'blogpost'}
>
<div class="container mx-auto flex justify-between items-center h-full gap-6 overflow-x-auto">
<Drawer />
{#if current === 'blog'}
{#if current === 'blog' || current === 'blogpost'}
<Coredump height="95%" href="/blog" />
{:else}
<Name height="95%" href="/" />
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/Toc/TocHeader.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
}
</script>

<nav class="fixed top-16 left-0 w-full bg-background bg-opacity-50 backdrop-blur-lg z-30 lg:hidden">
<nav class="sticky top-0 left-0 w-full bg-background bg-opacity-50 backdrop-blur-lg z-30 lg:hidden">
<Accordion.Root class="px-8" bind:value>
<Accordion.Item value="toc">
<Accordion.Trigger
Expand Down

1 comment on commit 8bc54c7

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@check-spelling-bot Report

🔴 Please review

See the 📜action log or 📝 job summary for details.

Unrecognized words (1)

blogpost

Previously acknowledged words that are now absent pcss zilla 🫥
To accept these unrecognized words as correct and remove the previously acknowledged and now absent words, you could run the following commands

... in a clone of the [email protected]:couscousdude/coredump.git repository
on the main branch (ℹ️ how do I use this?):

curl -s -S -L 'https://raw.githubusercontent.com/check-spelling/check-spelling/main/apply.pl' |
perl - 'https://github.com/couscousdude/coredump/actions/runs/9058800657/attempts/1'
Available 📚 dictionaries could cover words (expected and unrecognized) not in the 📘 dictionary

This includes both expected items (208) from .github/actions/spelling/expect.txt and unrecognized words (1)

Dictionary Entries Covers Uniquely
cspell:cryptocurrencies/cryptocurrencies.txt 125 1 1
cspell:ruby/dict/ruby.txt 157 1 1

Consider adding them (in .github/workflows/spelling.yml) for uses: check-spelling/check-spelling@main in its with:

      with:
        extra_dictionaries:
          cspell:cryptocurrencies/cryptocurrencies.txt
          cspell:ruby/dict/ruby.txt

To stop checking additional dictionaries, add (in .github/workflows/spelling.yml) for uses: check-spelling/check-spelling@main in its with:

check_extra_dictionaries: ''

Please sign in to comment.