Skip to content

Commit

Permalink
Merge branch 'prod'
Browse files Browse the repository at this point in the history
  • Loading branch information
cagataycivici committed Feb 6, 2024
2 parents 51e7591 + 22e2116 commit 36c0cdd
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 29 deletions.
7 changes: 0 additions & 7 deletions app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,6 @@ export default {
});
},
mounted() {
const preferredColorScheme = localStorage.getItem(this.$appState.colorSchemeKey);
const prefersDarkColorScheme = window.matchMedia('(prefers-color-scheme: dark)').matches;
if ((preferredColorScheme === null && prefersDarkColorScheme) || preferredColorScheme === 'dark') {
this.applyTheme({ theme: 'aura-dark-green', dark: true });
}
EventBus.on('theme-change', this.themeChangeListener);
},
beforeUnmount() {
Expand Down
7 changes: 0 additions & 7 deletions error.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,6 @@ export default {
});
},
mounted() {
const preferredColorScheme = localStorage.getItem(this.$appState.colorSchemeKey);
const prefersDarkColorScheme = window.matchMedia('(prefers-color-scheme: dark)').matches;
if ((preferredColorScheme === null && prefersDarkColorScheme) || preferredColorScheme === 'dark') {
this.applyTheme({ theme: 'aura-dark-green', dark: true });
}
EventBus.on('theme-change', this.themeChangeListener);
},
beforeUnmount() {
Expand Down
3 changes: 0 additions & 3 deletions layouts/default.vue
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,9 @@ export default {
if (this.$appState.darkTheme) {
newTheme = currentTheme.replace('dark', 'light');
localStorage.setItem(this.$appState.colorSchemeKey, 'light');
} else {
if (currentTheme.includes('light')) newTheme = currentTheme.replace('light', 'dark');
else newTheme = 'aura-dark-green'; //fallback
localStorage.setItem(this.$appState.colorSchemeKey, 'dark');
}
EventBus.emit('theme-change', { theme: newTheme, dark: !this.$appState.darkTheme });
Expand Down
10 changes: 0 additions & 10 deletions pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,22 +52,12 @@ export default {
expire.setTime(today.getTime() + 3600000 * 24 * 7);
document.cookie = 'primeaffiliateid=' + afId + ';expires=' + expire.toUTCString() + ';path=/; domain:primefaces.org';
}
const preferredColorScheme = localStorage.getItem(this.$appState.colorSchemeKey);
const prefersDarkColorScheme = window.matchMedia('(prefers-color-scheme: dark)').matches;
if ((preferredColorScheme === null && prefersDarkColorScheme) || preferredColorScheme === 'dark') {
this.replaceTableTheme('aura-dark-green');
} else {
this.replaceTableTheme('aura-light-green');
}
},
methods: {
onDarkModeToggle() {
const newTheme = this.$appState.darkTheme ? 'aura-light-green' : 'aura-dark-green';
const newTableTheme = this.$appState.darkTheme ? this.tableTheme.replace('dark', 'light') : this.tableTheme.replace('light', 'dark');
localStorage.setItem(this.$appState.colorSchemeKey, this.$appState.darkTheme ? 'light' : 'dark');
EventBus.emit('theme-change', { theme: newTheme, dark: !this.$appState.darkTheme });
this.replaceTableTheme(newTableTheme);
},
Expand Down
3 changes: 1 addition & 2 deletions plugins/app-state.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ const $appState = {
newsActive: false,
announcement: null,
ripple: false,
storageKey: 'primevue',
colorSchemeKey: 'primevue-color-scheme'
storageKey: 'primevue'
});
}
};
Expand Down

0 comments on commit 36c0cdd

Please sign in to comment.