work on palette editor

This commit is contained in:
Henry Jameson 2024-10-06 00:50:29 +03:00
parent 191609c662
commit 3f55c08693
3 changed files with 39 additions and 15 deletions

View file

@ -2,6 +2,7 @@ import { ref, reactive, computed, watch } from 'vue'
import { get, set } from 'lodash' import { get, set } from 'lodash'
import Select from 'src/components/select/select.vue' import Select from 'src/components/select/select.vue'
import SelectMotion from 'src/components/select/select_motion.vue'
import Checkbox from 'src/components/checkbox/checkbox.vue' import Checkbox from 'src/components/checkbox/checkbox.vue'
import ComponentPreview from 'src/components/component_preview/component_preview.vue' import ComponentPreview from 'src/components/component_preview/component_preview.vue'
import StringSetting from '../../helpers/string_setting.vue' import StringSetting from '../../helpers/string_setting.vue'
@ -42,6 +43,7 @@ library.add(
export default { export default {
components: { components: {
Select, Select,
SelectMotion,
Checkbox, Checkbox,
Tooltip, Tooltip,
StringSetting, StringSetting,
@ -117,6 +119,19 @@ export default {
} }
}) })
const getNewPalette = () => ({
name: 'new palette',
bg: '#121a24',
fg: '#182230',
text: '#b9b9ba',
link: '#d8a070',
accent: '#d8a070',
cRed: '#FF0000',
cBlue: '#0095ff',
cGreen: '#0fa00f',
cOrange: '#ffa500'
})
// ### I18n stuff // ### I18n stuff
// The paths in i18n are getting ridicously long, this effectively shortens them // The paths in i18n are getting ridicously long, this effectively shortens them
const getI18nPath = (componentName) => `settings.style.themes3.editor.components.${componentName}` const getI18nPath = (componentName) => `settings.style.themes3.editor.components.${componentName}`
@ -515,6 +530,7 @@ export default {
website, website,
palette, palette,
editedPalette, editedPalette,
getNewPalette,
componentKeys, componentKeys,
componentsMap, componentsMap,
selectedComponent, selectedComponent,

View file

@ -88,9 +88,12 @@
} }
.palette-editor { .palette-editor {
> .label:not(.Select) { display: grid;
font-weight: bold;
justify-self: right; .palette-selector {
&-label {
font-weight: bold;
}
} }
} }

View file

@ -260,29 +260,34 @@
:label="$t('settings.style.themes3.editor.palette_tab')" :label="$t('settings.style.themes3.editor.palette_tab')"
class="setting-item palette-editor" class="setting-item palette-editor"
> >
<div class="label"> <label
<label for="palette-selector"> class="palette-selector-label"
for="palette-selector"
>
{{ $t('settings.style.themes3.palette.label') }} {{ $t('settings.style.themes3.palette.label') }}
{{ ' ' }} {{ ' ' }}
</label> </label>
<Select <Select
id="palette-selector" id="palette-selector"
v-model="editedPalette" v-model="editedPalette"
class="palette-list"
size="10"
> >
<option <option
key="dark" v-for="(p, index) in palettes"
value="dark" :key="p"
:value="index"
> >
{{ $t('settings.style.themes3.palette.dark') }} {{ p }}
</option>
<option
key="light"
value="light"
>
{{ $t('settings.style.themes3.palette.light') }}
</option> </option>
</Select> </Select>
</div> <SelectMotion
class="palette-list-movement"
v-model="palettes"
:selected-id="editedPalette"
:get-add-value="getNewPalette"
@update:selectedId="e => editecPalette = e"
/>
<PaletteEditor v-model="palette" /> <PaletteEditor v-model="palette" />
</div> </div>
</tab-switcher> </tab-switcher>