budibase/packages/builder/src/userInterface/PagesList.svelte

86 lines
1.4 KiB
Svelte
Raw Normal View History

<script>
2020-02-03 10:50:30 +01:00
import { store } from "../builderStore"
import getIcon from "../common/icon"
2020-02-20 18:11:41 +01:00
import { CheckIcon } from "../common/Icons"
2020-02-03 10:50:30 +01:00
const getPage = (s, name) => {
const props = s.pages[name]
return { name, props }
}
2020-02-03 10:50:30 +01:00
const pages = [
{
title: "Main",
id: "main",
},
{
title: "Login",
id: "unauthenticated",
},
]
2020-02-03 10:50:30 +01:00
store.setCurrentPage("main")
</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">
{#if id === $store.currentPageName}
<CheckIcon />
{/if}
</span>
2020-02-20 18:11:41 +01:00
<button
class:active={id === $store.currentPageName}
on:click={() => store.setCurrentPage(id)}>
{title}
</button>
</li>
{/each}
</ul>
</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
}
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;
font-size: 0.8rem;
outline: none;
cursor: pointer;
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
}
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
}
</style>