Don't load theme options from the store
This commit is contained in:
parent
f34ac184ab
commit
d9bb41b2ce
|
@ -1,11 +1,10 @@
|
||||||
import { createLocalStorageStore } from "@budibase/frontend-core"
|
import { Constants, createLocalStorageStore } from "@budibase/frontend-core"
|
||||||
|
|
||||||
export const getThemeStore = () => {
|
export const getThemeStore = () => {
|
||||||
const themeElement = document.documentElement
|
const themeElement = document.documentElement
|
||||||
|
|
||||||
const initialValue = {
|
const initialValue = {
|
||||||
theme: "darkest",
|
theme: "darkest",
|
||||||
options: ["lightest", "light", "dark", "darkest", "nord"],
|
|
||||||
}
|
}
|
||||||
const store = createLocalStorageStore("bb-theme", initialValue)
|
const store = createLocalStorageStore("bb-theme", initialValue)
|
||||||
|
|
||||||
|
@ -17,7 +16,7 @@ export const getThemeStore = () => {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
state.options.forEach(option => {
|
Constants.ThemeOptions.forEach(option => {
|
||||||
themeElement.classList.toggle(
|
themeElement.classList.toggle(
|
||||||
`spectrum--${option}`,
|
`spectrum--${option}`,
|
||||||
option === state.theme
|
option === state.theme
|
||||||
|
|
|
@ -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-light.css"
|
||||||
import "@spectrum-css/vars/dist/spectrum-lightest.css"
|
import "@spectrum-css/vars/dist/spectrum-lightest.css"
|
||||||
import "@budibase/frontend-core/src/themes/nord.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 "@spectrum-css/page/dist/index-vars.css"
|
||||||
import "./global.css"
|
import "./global.css"
|
||||||
import { suppressWarnings } from "./helpers/warnings"
|
import { suppressWarnings } from "./helpers/warnings"
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
import { Layout, Heading, Body, Divider, Label, Select } from "@budibase/bbui"
|
import { Layout, Heading, Body, Divider, Label, Select } from "@budibase/bbui"
|
||||||
import { themeStore } from "builderStore"
|
import { themeStore } from "builderStore"
|
||||||
import { capitalise } from "helpers"
|
import { capitalise } from "helpers"
|
||||||
|
import { Constants } from "@budibase/frontend-core"
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Layout noPadding>
|
<Layout noPadding>
|
||||||
|
@ -14,7 +15,7 @@
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<Label size="L">Builder theme</Label>
|
<Label size="L">Builder theme</Label>
|
||||||
<Select
|
<Select
|
||||||
options={$themeStore.options}
|
options={Constants.ThemeOptions}
|
||||||
bind:value={$themeStore.theme}
|
bind:value={$themeStore.theme}
|
||||||
placeholder={null}
|
placeholder={null}
|
||||||
getOptionLabel={capitalise}
|
getOptionLabel={capitalise}
|
||||||
|
|
Loading…
Reference in New Issue