-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
351 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<script> | ||
import { getContext } from "svelte" | ||
export let title | ||
const createPaneStore = getContext("createPaneStore") | ||
$: paneStore = createPaneStore(title) | ||
</script> | ||
|
||
{#if $paneStore} | ||
<div class="pane"> | ||
<slot /> | ||
</div> | ||
{/if} | ||
|
||
<style> | ||
.pane { | ||
padding: 13px; | ||
} | ||
</style> |
112 changes: 112 additions & 0 deletions
112
packages/builder/src/components/design/RightPanel.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
<script> | ||
import { setContext } from "svelte" | ||
import { writable, get } from "svelte/store" | ||
import { Icon, Body, Button } from "@budibase/bbui" | ||
export let icon | ||
export let title | ||
let panes = {} | ||
let selectedPaneIdStore = writable(null) | ||
const createPaneStore = pane => { | ||
const id = crypto.randomUUID() | ||
return { | ||
subscribe: callback => { | ||
panes[id] = pane | ||
if (get(selectedPaneIdStore) === null) { | ||
selectedPaneIdStore.set(id) | ||
} | ||
const unsubscribeSelectedPaneIdStore = selectedPaneIdStore.subscribe( | ||
selectedPaneId => callback(selectedPaneId === id) | ||
) | ||
return () => { | ||
delete panes[id] | ||
panes = panes | ||
unsubscribeSelectedPaneIdStore() | ||
if (get(selectedPaneIdStore) === id) { | ||
const ids = Object.keys(panes) | ||
if (ids.length > 0) { | ||
selectedPaneIdStore.set(ids[0]) | ||
} else { | ||
selectedPaneIdStore.set(null) | ||
} | ||
} | ||
} | ||
}, | ||
} | ||
} | ||
setContext("createPaneStore", createPaneStore) | ||
</script> | ||
|
||
<div class="panel"> | ||
<div class="header"> | ||
<div class="icon"> | ||
<Icon name={icon} /> | ||
</div> | ||
<Body>{title}</Body> | ||
</div> | ||
<div class="controls"> | ||
{#each Object.entries(panes) as [id, pane]} | ||
<div class="button" class:active={$selectedPaneIdStore === id}> | ||
<Button on:click={() => selectedPaneIdStore.set(id)}>{pane}</Button> | ||
</div> | ||
{/each} | ||
</div> | ||
<div class="divider" /> | ||
|
||
<slot /> | ||
</div> | ||
|
||
<style> | ||
.panel { | ||
width: 310px; | ||
background: var(--background); | ||
} | ||
.header { | ||
display: flex; | ||
padding: 16px 14px; | ||
align-items: center; | ||
} | ||
.icon { | ||
color: var(--grey-6); | ||
margin-right: 8px; | ||
} | ||
.controls { | ||
padding: 0 14px 16px; | ||
display: flex; | ||
} | ||
.button:first-child { | ||
margin-right: 8px; | ||
} | ||
.button :global(button) { | ||
border-radius: 4px; | ||
border: none; | ||
background-color: var(--grey-1); | ||
color: var(--ink); | ||
} | ||
.button :global(button):hover { | ||
background-color: var(--grey-2); | ||
} | ||
.button.active :global(button) { | ||
background-color: var(--grey-2); | ||
} | ||
.divider { | ||
border-top: 1px solid var(--grey-3); | ||
} | ||
</style> |
33 changes: 0 additions & 33 deletions
33
...der/app/[application]/design/[screenId]/navigation/_components/NavigationInfoPanel.svelte
This file was deleted.
Oops, something went wrong.
176 changes: 176 additions & 0 deletions
176
...cation]/design/[screenId]/navigation/_components/NavigationInfoPanel/CustomizePane.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,176 @@ | ||
<script> | ||
import Pane from "components/design/Pane.svelte" | ||
import { | ||
ColorPicker, | ||
Input, | ||
Label, | ||
ActionGroup, | ||
ActionButton, | ||
Checkbox, | ||
notifications, | ||
Icon, | ||
Body, | ||
Button, | ||
Select, | ||
} from "@budibase/bbui" | ||
import { DefaultAppTheme } from "constants" | ||
import { store } from "builderStore" | ||
const update = async (key, value) => { | ||
try { | ||
let navigation = $store.navigation | ||
navigation[key] = value | ||
await store.actions.navigation.save(navigation) | ||
} catch (error) { | ||
notifications.error("Error updating navigation settings") | ||
} | ||
} | ||
</script> | ||
|
||
<Pane title="Customize"> | ||
<div class="info"> | ||
<div class="infoHeader"> | ||
<Icon name="InfoOutline" /> | ||
<Body size="S">CHANGES WILL APPLY TO ALL SCREENS</Body> | ||
</div> | ||
<Body> | ||
Your navigation is configured for all the screens within your app. | ||
</Body> | ||
</div> | ||
<div class="configureLinks"> | ||
<Button cta>Configure Links</Button> | ||
</div> | ||
<div class="controls"> | ||
<div class="label"> | ||
<Label size="M">Position</Label> | ||
</div> | ||
<ActionGroup quiet> | ||
<ActionButton | ||
selected={$store.navigation.navigation === "Top"} | ||
quiet={$store.navigation.navigation !== "Top"} | ||
icon="PaddingTop" | ||
on:click={() => update("navigation", "Top")} | ||
/> | ||
<ActionButton | ||
selected={$store.navigation.navigation === "Left"} | ||
quiet={$store.navigation.navigation !== "Left"} | ||
icon="PaddingLeft" | ||
on:click={() => update("navigation", "Left")} | ||
/> | ||
</ActionGroup> | ||
|
||
{#if $store.navigation.navigation === "Top"} | ||
<div class="label"> | ||
<Label size="M">Sticky header</Label> | ||
</div> | ||
<Checkbox | ||
value={$store.navigation.sticky} | ||
on:change={e => update("sticky", e.detail)} | ||
/> | ||
<div class="label"> | ||
<Label size="M">Width</Label> | ||
</div> | ||
<Select | ||
options={["Max", "Large", "Medium", "Small"]} | ||
plaveholder={null} | ||
value={$store.navigation.navWidth} | ||
on:change={e => update("navWidth", e.detail)} | ||
/> | ||
{/if} | ||
<div class="label"> | ||
<Label size="M">Show logo</Label> | ||
</div> | ||
<Checkbox | ||
value={!$store.navigation.hideLogo} | ||
on:change={e => update("hideLogo", !e.detail)} | ||
/> | ||
{#if !$store.navigation.hideLogo} | ||
<div class="label"> | ||
<Label size="M">Logo URL</Label> | ||
</div> | ||
<Input | ||
value={$store.navigation.logoUrl} | ||
on:change={e => update("logoUrl", e.detail)} | ||
updateOnChange={false} | ||
/> | ||
{/if} | ||
<div class="label"> | ||
<Label size="M">Show title</Label> | ||
</div> | ||
<Checkbox | ||
value={!$store.navigation.hideTitle} | ||
on:change={e => update("hideTitle", !e.detail)} | ||
/> | ||
{#if !$store.navigation.hideTitle} | ||
<div class="label"> | ||
<Label size="M">Title</Label> | ||
</div> | ||
<Input | ||
value={$store.navigation.title} | ||
on:change={e => update("title", e.detail)} | ||
updateOnChange={false} | ||
/> | ||
{/if} | ||
<div class="label"> | ||
<Label>Background</Label> | ||
</div> | ||
<ColorPicker | ||
spectrumTheme={$store.theme} | ||
value={$store.navigation.navBackground || DefaultAppTheme.navBackground} | ||
on:change={e => update("navBackground", e.detail)} | ||
/> | ||
<div class="label"> | ||
<Label>Text</Label> | ||
</div> | ||
<ColorPicker | ||
spectrumTheme={$store.theme} | ||
value={$store.navigation.navTextColor || DefaultAppTheme.navTextColor} | ||
on:change={e => update("navTextColor", e.detail)} | ||
/> | ||
</div> | ||
</Pane> | ||
|
||
<style> | ||
.controls { | ||
position: relative; | ||
display: grid; | ||
grid-template-columns: 90px 1fr; | ||
align-items: start; | ||
transition: background 130ms ease-out, border-color 130ms ease-out; | ||
border-left: 4px solid transparent; | ||
margin: 0 calc(-1 * var(--spacing-xl)); | ||
padding: 0 var(--spacing-xl) 0 calc(var(--spacing-xl) - 4px); | ||
gap: 12px; | ||
} | ||
.label { | ||
margin-top: 16px; | ||
transform: translateY(-50%); | ||
} | ||
.info { | ||
background-color: var(--background-alt); | ||
padding: 12px; | ||
margin-bottom: 12px; | ||
} | ||
.infoHeader { | ||
display: flex; | ||
margin-bottom: 5px; | ||
border-radius: 4px; | ||
} | ||
.infoHeader :global(svg) { | ||
margin-right: 5px; | ||
color: var(--grey-6); | ||
} | ||
.infoHeader :global(p) { | ||
color: var(--grey-6); | ||
} | ||
.configureLinks :global(button) { | ||
margin-bottom: 20px; | ||
width: 100%; | ||
} | ||
</style> |
31 changes: 31 additions & 0 deletions
31
...ication]/design/[screenId]/navigation/_components/NavigationInfoPanel/SettingsPane.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<script> | ||
import Pane from "components/design/Pane.svelte" | ||
import { get } from "svelte/store" | ||
import { Toggle, Body } from "@budibase/bbui" | ||
import { selectedScreen, store } from "builderStore" | ||
const updateShowNavigation = async e => { | ||
await store.actions.screens.updateSetting( | ||
get(selectedScreen), | ||
"showNavigation", | ||
e.detail | ||
) | ||
} | ||
</script> | ||
|
||
<Pane title="Settings"> | ||
<div class="toggle"> | ||
<Toggle | ||
on:change={updateShowNavigation} | ||
value={$selectedScreen.showNavigation} | ||
/> | ||
<Body size="S">Show nav on this screen</Body> | ||
</div> | ||
</Pane> | ||
|
||
<style> | ||
.toggle { | ||
display: flex; | ||
align-items: center; | ||
} | ||
</style> |
10 changes: 10 additions & 0 deletions
10
...p/[application]/design/[screenId]/navigation/_components/NavigationInfoPanel/index.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<script> | ||
import RightPanel from "components/design/RightPanel.svelte" | ||
import CustomizePane from "./CustomizePane.svelte" | ||
import SettingsPane from "./SettingsPane.svelte" | ||
</script> | ||
|
||
<RightPanel title="Screen" icon="WebPage"> | ||
<SettingsPane /> | ||
<CustomizePane /> | ||
</RightPanel> |
2 changes: 1 addition & 1 deletion
2
...ges/builder/src/pages/builder/app/[application]/design/[screenId]/navigation/index.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters