corrects page switching behaviour in page selection component
This commit is contained in:
parent
d931b9018b
commit
6cc8d7982e
|
@ -1,5 +1,5 @@
|
|||
<script>
|
||||
import { params } from "@sveltech/routify"
|
||||
import { params, goto } from "@sveltech/routify"
|
||||
import { store } from "builderStore"
|
||||
import getIcon from "components/common/icon"
|
||||
import { CheckIcon } from "components/common/Icons"
|
||||
|
@ -21,6 +21,11 @@
|
|||
]
|
||||
|
||||
store.setCurrentPage($params.page ? $params.page : "main")
|
||||
|
||||
const changePage = id => {
|
||||
store.setCurrentPage(id)
|
||||
$goto(`./${id}`)
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="root">
|
||||
|
@ -28,14 +33,14 @@
|
|||
{#each pages as { title, id }}
|
||||
<li>
|
||||
<span class="icon">
|
||||
{#if id === $store.currentPageName}
|
||||
{#if id === $params.page}
|
||||
<CheckIcon />
|
||||
{/if}
|
||||
</span>
|
||||
|
||||
<button
|
||||
class:active={id === $store.currentPageName}
|
||||
on:click={() => store.setCurrentPage(id)}>
|
||||
class:active={id === $params.page}
|
||||
on:click={() => changePage(id)}>
|
||||
{title}
|
||||
</button>
|
||||
</li>
|
||||
|
|
Loading…
Reference in New Issue