mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
add light and dark mode in seperate scss, add switch in sidebar
This commit is contained in:
parent
733bc69abe
commit
172eeaeeaf
19
frontend/src/assets/scss/gradido-template-dark.scss
Normal file
19
frontend/src/assets/scss/gradido-template-dark.scss
Normal file
@ -0,0 +1,19 @@
|
||||
$dark: #171717;
|
||||
$mode-toggle-bg: #262626;
|
||||
|
||||
// _dark-mode.scss
|
||||
#app {
|
||||
&.dark-mode {
|
||||
background-color: black;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
#app a,
|
||||
.navbar-light,
|
||||
.navbar-nav,
|
||||
.nav-link {
|
||||
&.dark-mode {
|
||||
color: #a7ffa9;
|
||||
}
|
||||
}
|
||||
@ -1,6 +1,8 @@
|
||||
html,
|
||||
body {
|
||||
background-color: #fff;
|
||||
height: 100%;
|
||||
transition: background-color .5s ease, color .5s ease;
|
||||
}
|
||||
|
||||
.pointer {
|
||||
|
||||
@ -52,3 +52,4 @@
|
||||
// Bootstrap-vue (2.21.1) scss
|
||||
@import "~bootstrap-vue/src/index";
|
||||
@import "gradido-template";
|
||||
@import "gradido-template-dark";
|
||||
|
||||
@ -36,9 +36,19 @@
|
||||
</b-nav>
|
||||
<hr />
|
||||
<b-nav vertical class="w-100">
|
||||
<b-nav-item to="#" class="mb-3">
|
||||
<b-icon icon="toggle-off" aria-hidden="true"></b-icon>
|
||||
<b-nav-item
|
||||
@click="
|
||||
lightmode = !lightmode
|
||||
$emit('modeToggle')
|
||||
"
|
||||
class="mb-3"
|
||||
>
|
||||
<b-icon :icon="lightmode ? 'toggle-on' : 'toggle-off'" aria-hidden="true"></b-icon>
|
||||
<span class="d-none d-lg-inline ml-2">{{ $t('navigation.lightmode') }}</span>
|
||||
<label for="checkbox" class="switch-label">
|
||||
<span v-if="lightmode">🌙</span>
|
||||
<span v-else>☀️</span>
|
||||
</label>
|
||||
</b-nav-item>
|
||||
<b-nav-item to="/settings" class="mb-3">
|
||||
<b-icon icon="gear" aria-hidden="true"></b-icon>
|
||||
@ -60,6 +70,11 @@
|
||||
<script>
|
||||
export default {
|
||||
name: 'sidebar',
|
||||
data() {
|
||||
return {
|
||||
lightmode: false,
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
|
||||
@ -35,7 +35,12 @@
|
||||
@admin="admin"
|
||||
@logout="logout"
|
||||
/> -->
|
||||
<sidebar-new class="main-sidebar" @admin="admin" @logout="logout" />
|
||||
<sidebar-new
|
||||
class="main-sidebar"
|
||||
@admin="admin"
|
||||
@logout="logout"
|
||||
@modeToggle="modeToggle"
|
||||
/>
|
||||
</b-col>
|
||||
<b-col
|
||||
cols="12"
|
||||
@ -119,6 +124,7 @@ export default {
|
||||
visible: false,
|
||||
tunneledEmail: null,
|
||||
hamburger: true,
|
||||
darkMode: false,
|
||||
}
|
||||
},
|
||||
provide() {
|
||||
@ -187,6 +193,30 @@ export default {
|
||||
this.$refs.sideMenu.classList.toggle('d-none')
|
||||
this.hamburger ? (this.hamburger = false) : (this.hamburger = true)
|
||||
},
|
||||
dark() {
|
||||
document.getElementById('app').classList.add('dark-mode')
|
||||
document.querySelector('#app a').classList.add('dark-mode')
|
||||
this.darkMode = true
|
||||
},
|
||||
|
||||
light() {
|
||||
document.getElementById('app').classList.remove('dark-mode')
|
||||
document.querySelector('#app a').classList.remove('dark-mode')
|
||||
this.darkMode = false
|
||||
},
|
||||
|
||||
modeToggle() {
|
||||
if (this.darkMode || document.getElementById('app').classList.contains('dark-mode')) {
|
||||
this.light()
|
||||
} else {
|
||||
this.dark()
|
||||
}
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
darkDark() {
|
||||
return this.darkMode && 'darkmode-toggled'
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user