1
0
Fork 0
mirror of synced 2024-09-28 07:11:40 +12:00

Don't load theme options from the store

This commit is contained in:
Andrew Kingston 2022-07-26 13:41:30 +01:00
parent f34ac184ab
commit d9bb41b2ce
3 changed files with 5 additions and 4 deletions

View file

@ -1,11 +1,10 @@
import { createLocalStorageStore } from "@budibase/frontend-core"
import { Constants, createLocalStorageStore } from "@budibase/frontend-core"
export const getThemeStore = () => {
const themeElement = document.documentElement
const initialValue = {
theme: "darkest",
options: ["lightest", "light", "dark", "darkest", "nord"],
}
const store = createLocalStorageStore("bb-theme", initialValue)
@ -17,7 +16,7 @@ export const getThemeStore = () => {
return
}
state.options.forEach(option => {
Constants.ThemeOptions.forEach(option => {
themeElement.classList.toggle(
`spectrum--${option}`,
option === state.theme

View file

@ -6,6 +6,7 @@ import "@spectrum-css/vars/dist/spectrum-dark.css"
import "@spectrum-css/vars/dist/spectrum-light.css"
import "@spectrum-css/vars/dist/spectrum-lightest.css"
import "@budibase/frontend-core/src/themes/nord.css"
import "@budibase/frontend-core/src/themes/midnight.css"
import "@spectrum-css/page/dist/index-vars.css"
import "./global.css"
import { suppressWarnings } from "./helpers/warnings"

View file

@ -2,6 +2,7 @@
import { Layout, Heading, Body, Divider, Label, Select } from "@budibase/bbui"
import { themeStore } from "builderStore"
import { capitalise } from "helpers"
import { Constants } from "@budibase/frontend-core"
</script>
<Layout noPadding>
@ -14,7 +15,7 @@
<div class="field">
<Label size="L">Builder theme</Label>
<Select
options={$themeStore.options}
options={Constants.ThemeOptions}
bind:value={$themeStore.theme}
placeholder={null}
getOptionLabel={capitalise}