update backendNav to use routify

This commit is contained in:
kevmodrome 2020-04-02 18:23:05 +02:00
parent 1b52077738
commit 8ba86adbc9
2 changed files with 11 additions and 3 deletions

View File

@ -41,7 +41,10 @@
</div> </div>
{/if} {/if}
<NavItem name="ACCESS_LEVELS" label="User Access Levels" /> <NavItem
name="ACCESS_LEVELS"
label="User Access Levels"
href="./accesslevels" />
</div> </div>
<style> <style>

View File

@ -1,9 +1,13 @@
<script> <script>
import { isActive, url, goto } from "@sveltech/routify"
import getIcon from "../common/icon" import getIcon from "../common/icon"
import { backendUiStore } from "builderStore" import { backendUiStore } from "builderStore"
export let name = "" export let name = ""
export let label = "" export let label = ""
export let href
$: console.log("Active: ", $isActive(href))
$: navActive = $backendUiStore.leftNavItem === name $: navActive = $backendUiStore.leftNavItem === name
@ -11,14 +15,15 @@
</script> </script>
<div <div
on:click={() => $goto($url(href))}
class="budibase__nav-item backend-nav-item" class="budibase__nav-item backend-nav-item"
class:selected={navActive} class:selected={$isActive(href)}>
on:click={setActive}>
{label} {label}
</div> </div>
<style> <style>
.backend-nav-item { .backend-nav-item {
padding-left: 25px; padding-left: 25px;
cursor: pointer;
} }
</style> </style>