diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/components/font_control/font_control.vue | 1 | ||||
| -rw-r--r-- | src/components/style_switcher/style_switcher.js | 29 |
2 files changed, 25 insertions, 5 deletions
diff --git a/src/components/font_control/font_control.vue b/src/components/font_control/font_control.vue index e97a2640..85f19eea 100644 --- a/src/components/font_control/font_control.vue +++ b/src/components/font_control/font_control.vue @@ -76,7 +76,6 @@ export default { }, preset: { get () { - console.log(this.family) if (this.family === 'serif' || this.family === 'sans-serif' || this.family === 'monospace' || diff --git a/src/components/style_switcher/style_switcher.js b/src/components/style_switcher/style_switcher.js index bbd28bdc..d833341f 100644 --- a/src/components/style_switcher/style_switcher.js +++ b/src/components/style_switcher/style_switcher.js @@ -106,7 +106,31 @@ export default { window.fetch('/static/styles.json') .then((data) => data.json()) .then((themes) => { - self.availableStyles = themes + return Promise.all(Object.entries(themes).map(([k, v]) => { + if (typeof v === 'object') { + return Promise.resolve([k, v]) + } else if (typeof v === 'string') { + return window.fetch(v) + .then((data) => data.json()) + .then((theme) => { + return [k, theme] + }) + .catch((e) => { + console.error(e) + return [] + }) + } + })) + }) + .then((promises) => { + return promises + .filter(([k, v]) => v) + .reduce((acc, [k, v]) => { + acc[k] = v + return acc + }, {}) + }).then((themesComplete) => { + self.availableStyles = themesComplete }) }, mounted () { @@ -184,7 +208,6 @@ export default { }, previewTheme () { if (!this.preview.theme.colors) return { colors: {}, opacity: {}, radii: {}, shadows: {}, fonts: {} } - console.log(this.preview.theme) return this.preview.theme }, // This needs optimization maybe @@ -515,8 +538,6 @@ export default { handler () { try { this.previewFonts = generateFonts({ fonts: this.fontsLocal }) - console.log('BENIS') - console.log(this.previewFonts) this.fontsInvalid = false } catch (e) { this.fontsInvalid = true |
