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"
|
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 = [
|
|
|
|
{
|
2020-06-11 21:18:59 +02:00
|
|
|
title: "Private",
|
2020-02-03 10:50:30 +01:00
|
|
|
id: "main",
|
|
|
|
},
|
|
|
|
{
|
2020-06-11 21:18:59 +02:00
|
|
|
title: "Public",
|
2020-02-03 10:50:30 +01:00
|
|
|
id: "unauthenticated",
|
|
|
|
},
|
|
|
|
]
|
2020-01-20 16:41:40 +01:00
|
|
|
|
2020-05-29 15:56:21 +02:00
|
|
|
if (!$store.currentPageName)
|
|
|
|
store.setCurrentPage($params.page ? $params.page : "main")
|
2020-04-28 14:28:23 +02:00
|
|
|
|
2020-10-22 19:11:33 +02:00
|
|
|
const changePage = (id) => {
|
2020-04-28 14:28:23 +02:00
|
|
|
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-05-29 19:32:52 +02:00
|
|
|
{#each pages as { title, id }}
|
|
|
|
<button class:active={id === $params.page} on:click={() => changePage(id)}>
|
|
|
|
{title}
|
|
|
|
</button>
|
|
|
|
{/each}
|
2019-08-02 15:54:10 +02:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<style>
|
2020-02-03 10:50:30 +01:00
|
|
|
.root {
|
2020-05-29 19:31:47 +02:00
|
|
|
display: flex;
|
|
|
|
flex-direction: row;
|
2020-02-20 18:11:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
button {
|
|
|
|
cursor: pointer;
|
2020-10-22 19:11:33 +02:00
|
|
|
padding: 0 var(--spacing-m);
|
|
|
|
height: 32px;
|
2020-05-29 19:31:47 +02:00
|
|
|
text-align: center;
|
|
|
|
background: #ffffff;
|
2020-06-23 09:19:16 +02:00
|
|
|
color: var(--grey-7);
|
2020-05-29 19:31:47 +02:00
|
|
|
border-radius: 5px;
|
2020-10-22 19:11:33 +02:00
|
|
|
font-size: var(--font-size-xs);
|
|
|
|
font-weight: 500;
|
2020-05-29 19:31:47 +02:00
|
|
|
transition: all 0.3s;
|
|
|
|
text-rendering: optimizeLegibility;
|
|
|
|
border: none !important;
|
2020-06-23 09:19:16 +02:00
|
|
|
outline: none;
|
2020-10-22 19:11:33 +02:00
|
|
|
font-family: var(--font-sans);
|
2020-02-20 18:11:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
.active {
|
2020-06-23 09:19:16 +02:00
|
|
|
background: var(--grey-3);
|
|
|
|
color: var(--ink);
|
2020-02-03 10:50:30 +01:00
|
|
|
}
|
2020-01-20 16:41:40 +01:00
|
|
|
</style>
|