Skip to content

Commit

Permalink
Makes viewer sidebar icon responsive to sidebar open state
Browse files Browse the repository at this point in the history
  • Loading branch information
allanlasser committed Dec 22, 2023
1 parent 832b305 commit f9e0012
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/pages/viewer/Header.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
<script lang="ts">
import { _ } from "svelte-i18n";
import { ChevronLeft24, SidebarExpand24 } from "svelte-octicons";
import {
ChevronLeft24,
SidebarCollapse24,
SidebarExpand24,
} from "svelte-octicons";
import { createEventDispatcher } from "svelte";
import Loader from "../../common/Loader.svelte";
Expand All @@ -17,6 +21,7 @@
export let showOrg = true;
export let disableControls = false;
export let embed = false;
export let sidebarOpen: boolean;
const dispatch = createEventDispatcher();
</script>
Expand Down Expand Up @@ -58,7 +63,10 @@
class="plausible-event-name=viewer-hamburger"
on:click={(e) => dispatch("toggle.sidebar")}
>
<SidebarExpand24 slot="icon" />
<span slot="icon"
>{#if sidebarOpen}<SidebarCollapse24 />{:else}<SidebarExpand24
/>{/if}</span
>
</Hamburger>
</div>
</header>
Expand Down
1 change: 1 addition & 0 deletions src/pages/viewer/Viewer.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@
showOrg={$layout.title}
disableControls={$layout.disableControls}
embed={$viewer.embed}
sidebarOpen={$layout.showSidebar}
on:toggle.sidebar={($layout.showSidebar = !$layout.showSidebar)}
/>
{#if $doc.mode == "image"}
Expand Down

0 comments on commit f9e0012

Please sign in to comment.