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

62 lines
1.5 KiB
Svelte
Raw Normal View History

2019-08-27 08:32:56 +02:00
<script>
import Textbox from "../common/Textbox.svelte";
import Dropdown from "../common/Dropdown.svelte";
import Button from "../common/Button.svelte";
import { store } from "../builderStore";
import { isRootComponent } from "./pagesParsing/searchComponents";
2019-09-03 13:12:24 +02:00
import {
filter,
find
} from "lodash/fp";
2019-08-27 08:32:56 +02:00
let entryComponent;
let title = "";
let components = [];
store.subscribe(s => {
2019-09-03 13:12:24 +02:00
title = s.currentFrontEndItem.index.title;
2019-08-27 08:32:56 +02:00
components = filter(s => !isRootComponent(s))(s.allComponents);
2019-09-03 13:12:24 +02:00
entryComponent = find(c => c.name === s.currentFrontEndItem.appBody)(components);
2019-08-27 08:32:56 +02:00
});
const save = () => {
const page = {
2019-09-03 13:12:24 +02:00
index: {
title
},
appBody: entryComponent.name,
2019-08-27 08:32:56 +02:00
}
store.savePage(page);
}
</script>
2019-09-03 13:12:24 +02:00
<div class="root">
2019-08-27 08:32:56 +02:00
2019-09-03 13:12:24 +02:00
<h3>{$store.currentPageName}</h3>
2019-08-27 08:32:56 +02:00
2019-09-03 13:12:24 +02:00
<form class="uk-form-horizontal">
<Textbox bind:text={title} label="Title" />
<div class="help-text">The title of your page, displayed in the bowser tab</div>
<Dropdown label="App Entry Component"
options={components}
bind:selected={entryComponent}
textMember={(v) => v.name} />
2019-08-27 08:32:56 +02:00
2019-09-03 13:12:24 +02:00
<div class="help-text">The component that will be loaded into the body of the page</div>
<div style="margin-top: 20px"></div>
<Button on:click={save}>Save</Button>
</form>
</div>
2019-08-27 08:32:56 +02:00
2019-09-03 13:12:24 +02:00
<style>
.root {
padding: 15px;
}
.help-text {
color: var(--slate);
font-size: 10pt;
}
2019-08-27 08:32:56 +02:00
</style>