style/layout improvements

This commit is contained in:
Henry Jameson 2024-11-14 17:25:58 +02:00
parent 86585cc644
commit 8901552112
6 changed files with 143 additions and 126 deletions

View file

@ -1,6 +1,21 @@
.settings_tab-switcher { .settings_tab-switcher {
height: 100%; height: 100%;
h1 {
margin-bottom: 0.5em;
margin-top: 0.5em;
}
h4 {
margin-bottom: 0;
margin-top: 0.25em;
}
h5 {
margin-bottom: 0;
margin-top: 0.25em;
}
.setting-item { .setting-item {
border-bottom: 2px solid var(--border); border-bottom: 2px solid var(--border);
margin: 1em 1em 1.4em; margin: 1em 1em 1.4em;

View file

@ -3,7 +3,7 @@
class="appearance-tab" class="appearance-tab"
:label="$t('settings.general')" :label="$t('settings.general')"
> >
<div class="setting-item heading"> <div class="setting-item">
<h2>{{ $t('settings.theme') }}</h2> <h2>{{ $t('settings.theme') }}</h2>
<button <button
class="btn button-default" class="btn button-default"

View file

@ -1,4 +1,4 @@
import { ref, reactive, computed, watch, watchEffect, provide } from 'vue' import { ref, reactive, computed, watch, watchEffect, provide, getCurrentInstance } from 'vue'
import { useStore } from 'vuex' import { useStore } from 'vuex'
import { get, set, unset, throttle } from 'lodash' import { get, set, unset, throttle } from 'lodash'
@ -84,6 +84,12 @@ export default {
// All rules that are made by editor // All rules that are made by editor
const allEditedRules = reactive({}) const allEditedRules = reactive({})
exports.isActive = computed(() => {
const tabSwitcher = getCurrentInstance().parent.ctx
console.log('TABSW', tabSwitcher)
return tabSwitcher ? tabSwitcher.isActive('style') : false
})
// ## Meta stuff // ## Meta stuff
exports.name = ref('') exports.name = ref('')
exports.author = ref('') exports.author = ref('')

View file

@ -48,33 +48,15 @@
} }
} }
.setting-item { .meta-preview {
padding-bottom: 0;
.btn {
padding: 0 0.5em;
}
&:not(:first-child) {
margin-top: 0.5em;
}
&:not(:last-child) {
margin-bottom: 0.5em;
}
&.heading {
display: grid; display: grid;
grid-template: grid-template:
"meta meta preview preview" "meta meta preview preview"
"meta meta preview preview" "meta meta preview preview"
"meta meta preview preview" "meta meta preview preview"
"meta meta preview preview" "meta meta preview preview";
"new new preview preview"
"load save refresh apply";
grid-gap: 0.5em; grid-gap: 0.5em;
grid-template-columns: min-content min-content 6fr max-content; grid-template-columns: min-content min-content 6fr max-content;
grid-template-rows: repeat(4, min-content) repeat(2, 2em);
ul.setting-list { ul.setting-list {
padding: 0; padding: 0;
@ -100,26 +82,21 @@
#edited-style-preview { #edited-style-preview {
grid-area: preview; grid-area: preview;
} }
.button-save {
grid-area: save;
} }
.button-load { .setting-item {
grid-area: load; padding-bottom: 0;
.btn {
padding: 0 0.5em;
} }
.button-new { &:not(:first-child) {
grid-area: new; margin-top: 0.5em;
} }
.button-refresh { &:not(:last-child) {
grid-area: refresh; margin-bottom: 0.5em;
}
.button-apply {
grid-area: apply;
}
} }
} }
@ -271,3 +248,17 @@
} }
} }
} }
.extra-content {
.style-actions-container {
width: 100%;
display: flex;
justify-content: end;
.style-actions {
display: grid;
grid-template-columns: repeat(4, minmax(7em, 1fr));
grid-gap: 0.25em;
}
}
}

View file

@ -4,6 +4,8 @@
<template> <template>
<div class="StyleTab"> <div class="StyleTab">
<div class="setting-item heading"> <div class="setting-item heading">
<h2> {{ $t('settings.style.themes3.editor.title') }} </h2>
<div class="meta-preview">
<!-- eslint-disable vue/no-v-text-v-html-on-component --> <!-- eslint-disable vue/no-v-text-v-html-on-component -->
<component <component
:is="'style'" :is="'style'"
@ -11,12 +13,18 @@
/> />
<!-- eslint-enable vue/no-v-text-v-html-on-component --> <!-- eslint-enable vue/no-v-text-v-html-on-component -->
<Preview id="edited-style-preview" /> <Preview id="edited-style-preview" />
<teleport
v-if="isActive"
to="#unscrolled-content"
>
<div class="style-actions-container">
<div class="style-actions">
<button <button
class="btn button-default button-new" class="btn button-default button-new"
@click="clearTheme" @click="clearTheme"
> >
<FAIcon icon="file" /> <FAIcon icon="arrows-rotate" />
{{ $t('settings.style.themes3.editor.new_style') }} {{ $t('settings.style.themes3.editor.reset_style') }}
</button> </button>
<button <button
class="btn button-default button-load" class="btn button-default button-load"
@ -32,13 +40,6 @@
<FAIcon icon="floppy-disk" /> <FAIcon icon="floppy-disk" />
{{ $t('settings.style.themes3.editor.save_style') }} {{ $t('settings.style.themes3.editor.save_style') }}
</button> </button>
<button
class="btn button-default button-refresh"
@click="updateOverallPreview"
>
<FAIcon icon="arrows-rotate" />
{{ $t('settings.style.themes3.editor.refresh_preview') }}
</button>
<button <button
class="btn button-default button-apply" class="btn button-default button-apply"
@click="applyStyle" @click="applyStyle"
@ -46,6 +47,9 @@
<FAIcon icon="check" /> <FAIcon icon="check" />
{{ $t('settings.style.themes3.editor.apply_preview') }} {{ $t('settings.style.themes3.editor.apply_preview') }}
</button> </button>
</div>
</div>
</teleport>
<ul class="setting-list style-metadata"> <ul class="setting-list style-metadata">
<li> <li>
<StringSetting class="meta-field" v-model="name"> <StringSetting class="meta-field" v-model="name">
@ -69,6 +73,7 @@
</li> </li>
</ul> </ul>
</div> </div>
</div>
<tab-switcher> <tab-switcher>
<div <div
key="component" key="component"

View file

@ -777,7 +777,7 @@
}, },
"editor": { "editor": {
"title": "Style", "title": "Style",
"new_style": "New", "reset_style": "Reset",
"load_style": "Open", "load_style": "Open",
"save_style": "Save", "save_style": "Save",
"style_name": "Stylesheet name", "style_name": "Stylesheet name",