change topnav back for now

This commit is contained in:
kevmodrome 2020-04-09 10:16:15 +02:00
parent f41110ec74
commit eb0298420e
1 changed files with 8 additions and 6 deletions

View File

@ -2,7 +2,7 @@
import { store } from "builderStore" import { store } from "builderStore"
import { fade } from "svelte/transition" import { fade } from "svelte/transition"
import { isActive, goto, url, layout } from "@sveltech/routify" import { isActive, goto, context } from "@sveltech/routify"
import { SettingsIcon, PreviewIcon } from "components/common/Icons/" import { SettingsIcon, PreviewIcon } from "components/common/Icons/"
import IconButton from "components/common/IconButton.svelte" import IconButton from "components/common/IconButton.svelte"
@ -23,6 +23,8 @@
throw new Error(pkg) throw new Error(pkg)
} }
} }
$: ({ component } = $context)
$: list = component.parent.children.filter(child => child.isIndexable)
</script> </script>
<div class="root"> <div class="root">
@ -35,12 +37,12 @@
alt="budibase icon" /> alt="budibase icon" />
</button> </button>
<!-- List is an array of subfolders in the application folder. --> <!-- This gets all indexable subroutes and sticks them in the top nav. -->
{#each $layout.children as { path, prettyName, children, meta }} {#each list as { path, prettyName, children, meta }}
<span <span
class:active={$isActive(path)} class:active={$isActive(path)}
class="topnavitem" class="topnavitem"
on:click={() => $goto($url(path))}> on:click={() => $goto(path)}>
{prettyName} {prettyName}
</span> </span>
{/each} {/each}
@ -50,9 +52,9 @@
</div> </div>
<div class="toprightnav"> <div class="toprightnav">
<span <span
class:active={$isActive(`${component.parent.path}/settings`)} class:active={$isActive(`/settings`)}
class="topnavitemright" class="topnavitemright"
on:click={() => $goto(`${component.parent.path}/settings`)}> on:click={() => $goto(`/settings`)}>
<SettingsIcon /> <SettingsIcon />
</span> </span>
<span <span