Skip to content

Commit

Permalink
Different approach to hiding nav
Browse files Browse the repository at this point in the history
  • Loading branch information
allanlasser committed Dec 10, 2024
1 parent 1ec8a75 commit 2feb263
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
14 changes: 6 additions & 8 deletions src/lib/components/layouts/DocumentLayout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,12 @@ Assumes it's a child of a ViewerContext
$: projects = (document.projects ?? []) as Project[];
</script>

<SidebarLayout>
<SignedIn slot="navigation">
<nav class="column">
<Projects {projects} {document} />
<Data {document} />
<Notes {document} />
</nav>
</SignedIn>
<SidebarLayout hideNavigation={!$me}>
<nav class="column" slot="navigation">
<Projects {projects} {document} />
<Data {document} />
<Notes {document} />
</nav>

<article slot="content">
<header><DocumentHeader {document} /></header>
Expand Down
7 changes: 5 additions & 2 deletions src/lib/components/layouts/SidebarLayout.svelte
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
<script lang="ts">
import Sidebar from "./Sidebar.svelte";
export let hideNavigation = false;
export let hideActions = false;
</script>

<div class="sidebarLayoutContainer">
{#if $$slots.navigation}
{#if $$slots.navigation && !hideNavigation}
<Sidebar position="left" id="navigation">
<slot name="navigation" />
</Sidebar>
Expand All @@ -13,7 +16,7 @@
<slot name="content" />
</div>

{#if $$slots.action}
{#if $$slots.action && !hideActions}
<Sidebar position="right" id="action">
<slot name="action" />
</Sidebar>
Expand Down

0 comments on commit 2feb263

Please sign in to comment.