2019-08-02 15:54:10 +02:00
|
|
|
<script>
|
2020-04-28 14:28:23 +02:00
|
|
|
import { params, goto } from "@sveltech/routify"
|
2020-03-31 13:16:03 +02:00
|
|
|
import { store } from "builderStore"
|
|
|
|
import getIcon from "components/common/icon"
|
|
|
|
import { CheckIcon } from "components/common/Icons"
|
2019-08-02 15:54:10 +02:00
|
|
|
|
2020-02-03 10:50:30 +01:00
|
|
|
const getPage = (s, name) => {
|
|
|
|
const props = s.pages[name]
|
|
|
|
return { name, props }
|
|
|
|
}
|
2019-08-02 15:54:10 +02:00
|
|
|
|
2020-02-03 10:50:30 +01:00
|
|
|
const pages = [
|
|
|
|
{
|
|
|
|
title: "Main",
|
|
|
|
id: "main",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: "Login",
|
|
|
|
id: "unauthenticated",
|
|
|
|
},
|
|
|
|
]
|
2020-01-20 16:41:40 +01:00
|
|
|
|
2020-04-28 14:21:40 +02:00
|
|
|
store.setCurrentPage($params.page ? $params.page : "main")
|
2020-04-28 14:28:23 +02:00
|
|
|
|
|
|
|
const changePage = id => {
|
|
|
|
store.setCurrentPage(id)
|
2020-05-04 10:32:25 +02:00
|
|
|
$goto(`./${id}/page-layout`)
|
2020-04-28 14:28:23 +02:00
|
|
|
}
|
2019-08-02 15:54:10 +02:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<div class="root">
|
2020-02-20 18:11:41 +01:00
|
|
|
<ul>
|
2020-02-03 10:50:30 +01:00
|
|
|
{#each pages as { title, id }}
|
2020-02-20 18:11:41 +01:00
|
|
|
<li>
|
|
|
|
<span class="icon">
|
2020-04-28 14:28:23 +02:00
|
|
|
{#if id === $params.page}
|
2020-02-20 18:11:41 +01:00
|
|
|
<CheckIcon />
|
|
|
|
{/if}
|
|
|
|
</span>
|
2019-08-02 15:54:10 +02:00
|
|
|
|
2020-02-20 18:11:41 +01:00
|
|
|
<button
|
2020-04-28 14:28:23 +02:00
|
|
|
class:active={id === $params.page}
|
|
|
|
on:click={() => changePage(id)}>
|
2020-02-20 18:11:41 +01:00
|
|
|
{title}
|
|
|
|
</button>
|
|
|
|
</li>
|
|
|
|
{/each}
|
|
|
|
</ul>
|
2019-08-02 15:54:10 +02:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<style>
|
2020-02-03 10:50:30 +01:00
|
|
|
.root {
|
|
|
|
padding-bottom: 10px;
|
|
|
|
font-size: 0.9rem;
|
2020-03-24 11:56:48 +01:00
|
|
|
color: #000333;
|
2020-02-03 10:50:30 +01:00
|
|
|
font-weight: bold;
|
|
|
|
position: relative;
|
2020-02-20 18:11:41 +01:00
|
|
|
padding-left: 1.8rem;
|
2020-02-03 10:50:30 +01:00
|
|
|
}
|
2019-08-02 15:54:10 +02:00
|
|
|
|
2020-02-20 18:11:41 +01:00
|
|
|
ul {
|
2020-02-03 10:50:30 +01:00
|
|
|
margin: 0;
|
2020-02-20 18:11:41 +01:00
|
|
|
padding: 0;
|
|
|
|
list-style: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
li {
|
|
|
|
margin: 0.5rem 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
button {
|
|
|
|
margin: 0 0 0 6px;
|
|
|
|
padding: 0;
|
2020-02-03 10:50:30 +01:00
|
|
|
border: none;
|
2020-02-20 18:11:41 +01:00
|
|
|
font-family: Roboto;
|
2020-04-03 15:26:07 +02:00
|
|
|
font-size: 13px;
|
2020-02-20 18:11:41 +01:00
|
|
|
outline: none;
|
|
|
|
cursor: pointer;
|
2020-03-27 17:58:32 +01:00
|
|
|
background: rgba(0, 0, 0, 0);
|
2020-02-20 18:11:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
.active {
|
|
|
|
font-weight: 500;
|
2020-02-03 10:50:30 +01:00
|
|
|
}
|
2019-08-02 15:54:10 +02:00
|
|
|
|
2020-02-20 18:11:41 +01:00
|
|
|
.icon {
|
|
|
|
display: inline-block;
|
|
|
|
width: 14px;
|
2020-03-24 11:56:48 +01:00
|
|
|
color: #000333;
|
2020-02-03 10:50:30 +01:00
|
|
|
}
|
2020-01-20 16:41:40 +01:00
|
|
|
</style>
|