1
0
Fork 0
mirror of synced 2024-07-06 23:10:57 +12:00

Account for mobile support with top navs

This commit is contained in:
Andrew Kingston 2024-04-09 12:04:12 +01:00
parent 9ac344f292
commit ffdb8ee1b6
2 changed files with 6 additions and 3 deletions

View file

@ -286,6 +286,7 @@
internalLink={navItem.internalLink}
on:clickLink={() => (mobileOpen = false)}
leftNav={navigation === "Left"}
{mobile}
{navStateStore}
/>
{/each}

View file

@ -9,6 +9,7 @@
export let subLinks
export let internalLink
export let leftNav = false
export let mobile = false
export let navStateStore
const dispatch = createEventDispatcher()
@ -18,7 +19,8 @@
let renderKey
$: expanded = !!$navStateStore[text]
$: icon = !leftNav || expanded ? "ChevronDown" : "ChevronRight"
$: renderLeftNav = leftNav || mobile
$: icon = !renderLeftNav || expanded ? "ChevronDown" : "ChevronRight"
const onClickLink = () => {
dispatch("clickLink")
@ -26,7 +28,7 @@
}
const onClickDropdown = () => {
if (!leftNav) {
if (!renderLeftNav) {
return
}
navStateStore.update(state => ({
@ -61,7 +63,7 @@
<!-- svelte-ignore a11y-no-static-element-interactions -->
<!-- svelte-ignore a11y-click-events-have-key-events -->
{#key renderKey}
<div class="dropdown" class:left={leftNav} class:expanded>
<div class="dropdown" class:left={renderLeftNav} class:expanded>
<div class="text" on:click={onClickDropdown}>
{text}
<Icon name={icon} />