|
|
|
@ -1,7 +1,48 @@ |
|
|
|
<script> |
|
|
|
import NavigationPanel from "components/design/navigation/NavigationPanel.svelte" |
|
|
|
import { Body, Layout } from "@budibase/bbui" |
|
|
|
import ThemeEditor from "./_components/ThemeEditor.svelte" |
|
|
|
import { |
|
|
|
Body, |
|
|
|
Layout, |
|
|
|
Label, |
|
|
|
ColorPicker, |
|
|
|
Button, |
|
|
|
notifications, |
|
|
|
} from "@budibase/bbui" |
|
|
|
import { store } from "builderStore" |
|
|
|
import { get } from "svelte/store" |
|
|
|
import { DefaultAppTheme } from "constants" |
|
|
|
|
|
|
|
const ButtonBorderRadiusOptions = [ |
|
|
|
{ |
|
|
|
label: "Square", |
|
|
|
value: "0", |
|
|
|
}, |
|
|
|
{ |
|
|
|
label: "Soft edge", |
|
|
|
value: "4px", |
|
|
|
}, |
|
|
|
{ |
|
|
|
label: "Curved", |
|
|
|
value: "8px", |
|
|
|
}, |
|
|
|
{ |
|
|
|
label: "Round", |
|
|
|
value: "16px", |
|
|
|
}, |
|
|
|
] |
|
|
|
|
|
|
|
$: customTheme = $store.customTheme || {} |
|
|
|
|
|
|
|
const update = async (property, value) => { |
|
|
|
try { |
|
|
|
store.actions.customTheme.save({ |
|
|
|
...get(store).customTheme, |
|
|
|
[property]: value, |
|
|
|
}) |
|
|
|
} catch (error) { |
|
|
|
notifications.error("Error updating custom theme") |
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|
|
|
|
|
<NavigationPanel title="Theme"> |
|
|
|
@ -9,6 +50,69 @@ |
|
|
|
<Body size="S"> |
|
|
|
Your theme is set across all the screens within your app |
|
|
|
</Body> |
|
|
|
<ThemeEditor /> |
|
|
|
<Layout noPadding gap="XS"> |
|
|
|
<Label>Theme</Label> |
|
|
|
</Layout> |
|
|
|
<Layout noPadding gap="XS"> |
|
|
|
<Label>Buttons</Label> |
|
|
|
<div class="buttons"> |
|
|
|
{#each ButtonBorderRadiusOptions as option} |
|
|
|
<div |
|
|
|
class:active={customTheme.buttonBorderRadius === option.value} |
|
|
|
style={`--radius: ${option.value}`} |
|
|
|
> |
|
|
|
<Button |
|
|
|
secondary |
|
|
|
on:click={() => update("buttonBorderRadius", option.value)} |
|
|
|
> |
|
|
|
{option.label} |
|
|
|
</Button> |
|
|
|
</div> |
|
|
|
{/each} |
|
|
|
</div> |
|
|
|
</Layout> |
|
|
|
<Layout noPadding gap="XS"> |
|
|
|
<Label>Accent color</Label> |
|
|
|
<ColorPicker |
|
|
|
spectrumTheme={$store.theme} |
|
|
|
value={customTheme.primaryColor || DefaultAppTheme.primaryColor} |
|
|
|
on:change={e => update("primaryColor", e.detail)} |
|
|
|
/> |
|
|
|
</Layout> |
|
|
|
<Layout noPadding gap="XS"> |
|
|
|
<Label>Accent color (hover)</Label> |
|
|
|
<ColorPicker |
|
|
|
spectrumTheme={$store.theme} |
|
|
|
value={customTheme.primaryColorHover || |
|
|
|
DefaultAppTheme.primaryColorHover} |
|
|
|
on:change={e => update("primaryColorHover", e.detail)} |
|
|
|
/> |
|
|
|
</Layout> |
|
|
|
</Layout> |
|
|
|
</NavigationPanel> |
|
|
|
|
|
|
|
<style> |
|
|
|
.buttons { |
|
|
|
display: grid; |
|
|
|
grid-template-columns: 100px 100px; |
|
|
|
gap: var(--spacing-m); |
|
|
|
} |
|
|
|
.buttons > div { |
|
|
|
display: contents; |
|
|
|
} |
|
|
|
.buttons > div :global(.spectrum-Button) { |
|
|
|
border-radius: var(--radius) !important; |
|
|
|
border-width: 1px; |
|
|
|
border-color: var(--spectrum-global-color-gray-400); |
|
|
|
font-weight: 600; |
|
|
|
} |
|
|
|
.buttons > div:hover :global(.spectrum-Button) { |
|
|
|
background: var(--spectrum-global-color-gray-700); |
|
|
|
border-color: var(--spectrum-global-color-gray-700); |
|
|
|
} |
|
|
|
.buttons > div.active :global(.spectrum-Button) { |
|
|
|
background: var(--spectrum-global-color-gray-200); |
|
|
|
color: var(--spectrum-global-color-gray-800); |
|
|
|
border-color: var(--spectrum-global-color-gray-600); |
|
|
|
} |
|
|
|
</style> |
|
|
|
|