Skip to content

Commit

Permalink
feat(docs): added global switch for dark theme
Browse files Browse the repository at this point in the history
  • Loading branch information
mtorromeo committed Nov 6, 2023
1 parent fa187ba commit 09905d7
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions apps/docs/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
<pf-toolbar>
<pf-toolbar-content>
<pf-toolbar-item>header-tools</pf-toolbar-item>
<pf-toolbar-item align="right">
<pf-switch v-model:checked="darkTheme" label="Dark theme" />
</pf-toolbar-item>
</pf-toolbar-content>
</pf-toolbar>
</pf-masthead-content>
Expand Down Expand Up @@ -78,6 +81,17 @@ const overflowMessage = computed(() => {
return '';
});
const darkTheme = computed({
get: ()=> document.documentElement.classList.contains('pf-v5-theme-dark'),
set(value) {
if (value) {
document.documentElement.classList.add('pf-v5-theme-dark');
} else {
document.documentElement.classList.remove('pf-v5-theme-dark');
}
},
});
function expandAlerts() {
maxDisplayed.value = 0;
}
Expand Down

0 comments on commit 09905d7

Please sign in to comment.