diff --git a/src/components/shadow_control/shadow_control.js b/src/components/shadow_control/shadow_control.js index 54813685f2..b4f486682c 100644 --- a/src/components/shadow_control/shadow_control.js +++ b/src/components/shadow_control/shadow_control.js @@ -37,9 +37,12 @@ export default { this.selectedId += 1 } }, + beforeUpdate () { + this.cValue = this.value || this.fallback + }, computed: { selected () { - return this.cValue[this.selectedId] || { + return this.isReady && this.cValue[this.selectedId] || { x: 0, y: 0, blur: 0, @@ -50,13 +53,17 @@ export default { } }, moveUpValid () { - return this.selectedId > 0 + return this.isReady && this.selectedId > 0 }, moveDnValid () { - return this.selectedId < this.cValue.length - 1 + return this.isReady && this.selectedId < this.cValue.length - 1 + }, + isReady () { + return typeof this.cValue !== 'undefined' }, present () { - return typeof this.cValue[this.selectedId] !== 'undefined' && + return this.isReady && + typeof this.cValue[this.selectedId] !== 'undefined' && !this.usingFallback }, usingFallback () { @@ -66,9 +73,9 @@ export default { return hex2rgb(this.selected.color) }, style () { - return { + return this.isReady ? { boxShadow: getCssShadow(this.cValue) - } + } : {} } } } diff --git a/src/components/shadow_control/shadow_control.vue b/src/components/shadow_control/shadow_control.vue index cd774d328c..f8066947be 100644 --- a/src/components/shadow_control/shadow_control.vue +++ b/src/components/shadow_control/shadow_control.vue @@ -43,7 +43,7 @@ - - @@ -137,7 +137,6 @@ flex-wrap: wrap; justify-content: center; - .shadow-preview-container, .shadow-tweak { margin: 5px 6px 0 0; diff --git a/src/components/style_switcher/style_switcher.js b/src/components/style_switcher/style_switcher.js index 7cb6197cde..acb1764d3f 100644 --- a/src/components/style_switcher/style_switcher.js +++ b/src/components/style_switcher/style_switcher.js @@ -93,6 +93,9 @@ export default { }, mounted () { this.normalizeLocalState(this.$store.state.config.customTheme) + if (typeof this.shadowSelected === 'undefined') { + this.shadowSelected = this.shadowsAvailable[0] + } }, computed: { selectedVersion () { @@ -180,6 +183,7 @@ export default { if (!this.preview.theme.colors) return { colors: {}, opacity: {}, radii: {}, shadows: {} } return this.preview.theme }, + // This needs optimization maybe previewContrast () { if (!this.previewTheme.colors.bg) return {} const colors = this.previewTheme.colors diff --git a/src/components/style_switcher/style_switcher.vue b/src/components/style_switcher/style_switcher.vue index 5f0c25664c..5cf75636db 100644 --- a/src/components/style_switcher/style_switcher.vue +++ b/src/components/style_switcher/style_switcher.vue @@ -198,7 +198,7 @@ - + diff --git a/src/components/tab_switcher/tab_switcher.jsx b/src/components/tab_switcher/tab_switcher.jsx index 3fff38f656..ea58245033 100644 --- a/src/components/tab_switcher/tab_switcher.jsx +++ b/src/components/tab_switcher/tab_switcher.jsx @@ -1,5 +1,7 @@ import Vue from 'vue' +// FIXME: This doesn't like v-if directly inside the tab's contents, breaks vue really bad + import './tab_switcher.scss' export default Vue.component('tab-switcher', {