Theme toggle bug fixed for landing page

pull/3449/head
Bahadır Sofuoğlu 2022-12-27 15:17:26 +03:00
parent 7538462bd2
commit 63d1a6bd9c
2 changed files with 12 additions and 11 deletions

View File

@ -1,6 +1,6 @@
<template>
<div :class="landingClass">
<Intro></Intro>
<Intro @change:theme="onThemeToggle"></Intro>
<ComponentSection />
<ThemeSection :theme="tableTheme" @table-theme-change="onTableThemeChange" />
<BlockSection />
@ -13,6 +13,7 @@
</template>
<script>
import EventBus from '@/layouts/AppEventBus';
import BlockSection from './landing/BlockSection';
import ComponentSection from './landing/ComponentSection';
import DesignerSection from './landing/DesignerSection';
@ -50,6 +51,13 @@ export default {
this.replaceTableTheme(this.$appState.darkTheme ? 'lara-dark-blue' : 'lara-light-blue');
},
methods: {
onThemeToggle() {
const newTheme = this.$appState.darkTheme ? 'lara-light-blue' : 'lara-dark-blue';
const newTableTheme = this.$appState.darkTheme ? this.tableTheme.replace('dark', 'light') : this.tableTheme.replace('light', 'dark');
EventBus.emit('theme-change', { theme: newTheme, dark: !this.$appState.darkTheme });
this.replaceTableTheme(newTableTheme);
},
onTableThemeChange(value) {
this.replaceTableTheme(value);
},

View File

@ -1,7 +1,7 @@
<template>
<div class="landing-intro">
<AppNews v-if="$appState.newsActive" />
<HeaderSection @theme-toggle="onThemeToggle" />
<HeaderSection @theme-toggle="$emit('change:theme')" />
<HeroSection />
</div>
</template>
@ -10,16 +10,9 @@
import AppNews from '@/layouts/AppNews';
import HeaderSection from './HeaderSection';
import HeroSection from './HeroSection';
export default {
methods: {
onThemeToggle() {
const newTheme = this.$appState.darkTheme ? 'lara-light-blue' : 'lara-dark-blue';
const newTableTheme = this.$appState.darkTheme ? this.tableTheme.replace('dark', 'light') : this.tableTheme.replace('light', 'dark');
EventBus.emit('theme-change', { theme: newTheme, dark: !this.$appState.darkTheme });
this.replaceTableTheme(newTableTheme);
}
},
export default {
emits: ['change:theme'],
components: {
HeaderSection,
HeroSection,