2019-06-03 03:31:38 +00:00
|
|
|
<template>
|
2020-03-23 00:43:49 +00:00
|
|
|
<div
|
|
|
|
class="container"
|
|
|
|
:class="theme"
|
|
|
|
>
|
2020-03-25 01:48:54 +00:00
|
|
|
<Sidebar
|
|
|
|
v-if="showSidebar"
|
|
|
|
:toggle-sidebar="toggleSidebar"
|
|
|
|
/>
|
|
|
|
|
|
|
|
<Header :toggle-sidebar="toggleSidebar" />
|
2019-06-03 03:31:38 +00:00
|
|
|
|
|
|
|
<div class="content">
|
2019-12-15 04:42:51 +00:00
|
|
|
<!-- key forces rerender when new and old path use same component -->
|
|
|
|
<router-view :key="$route.fullPath" />
|
2019-06-03 03:31:38 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2020-03-23 00:43:49 +00:00
|
|
|
import { mapState } from 'vuex';
|
|
|
|
|
2020-03-25 01:48:54 +00:00
|
|
|
import EventBus from '../../js/event-bus';
|
|
|
|
|
2019-06-03 03:31:38 +00:00
|
|
|
import Header from '../header/header.vue';
|
2020-03-25 01:48:54 +00:00
|
|
|
import Sidebar from '../sidebar/sidebar.vue';
|
2019-06-03 03:31:38 +00:00
|
|
|
|
2020-03-23 00:43:49 +00:00
|
|
|
function theme(state) {
|
|
|
|
return state.ui.theme;
|
|
|
|
}
|
|
|
|
|
2020-03-25 01:48:54 +00:00
|
|
|
function toggleSidebar(state) {
|
|
|
|
this.showSidebar = typeof state === 'boolean' ? state : !this.showSidebar;
|
|
|
|
}
|
|
|
|
|
|
|
|
function mounted() {
|
|
|
|
document.addEventListener('click', () => {
|
|
|
|
EventBus.$emit('blur');
|
|
|
|
this.showSidebar = false;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2019-06-03 03:31:38 +00:00
|
|
|
export default {
|
|
|
|
components: {
|
|
|
|
Header,
|
2020-03-25 01:48:54 +00:00
|
|
|
Sidebar,
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
showSidebar: false,
|
|
|
|
};
|
2019-06-03 03:31:38 +00:00
|
|
|
},
|
2020-03-23 00:43:49 +00:00
|
|
|
computed: {
|
|
|
|
...mapState({
|
|
|
|
theme,
|
|
|
|
}),
|
|
|
|
},
|
2020-03-25 01:48:54 +00:00
|
|
|
mounted,
|
|
|
|
methods: {
|
|
|
|
toggleSidebar,
|
|
|
|
},
|
2019-06-03 03:31:38 +00:00
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
2019-10-28 01:54:37 +00:00
|
|
|
<style lang="scss">
|
2019-11-14 00:18:19 +00:00
|
|
|
@import 'theme';
|
|
|
|
|
2019-09-24 23:38:06 +00:00
|
|
|
.container {
|
2020-03-25 01:48:54 +00:00
|
|
|
position: relative;
|
2019-09-24 23:38:06 +00:00
|
|
|
height: 100%;
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
overflow: hidden;
|
2020-03-25 01:48:54 +00:00
|
|
|
background: var(--background-dim);
|
2020-03-27 03:39:13 +00:00
|
|
|
color: var(--text);
|
2019-09-24 23:38:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.content {
|
2019-10-28 01:54:37 +00:00
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
2019-09-24 23:38:06 +00:00
|
|
|
flex-grow: 1;
|
2019-11-14 00:18:19 +00:00
|
|
|
overflow-y: auto;
|
2019-09-24 23:38:06 +00:00
|
|
|
}
|
|
|
|
|
2019-06-03 03:31:38 +00:00
|
|
|
.content-inner {
|
2019-10-28 01:54:37 +00:00
|
|
|
flex-grow: 1;
|
2019-06-03 03:31:38 +00:00
|
|
|
padding: 1rem;
|
2019-10-28 01:54:37 +00:00
|
|
|
overflow-y: auto;
|
2019-06-03 03:31:38 +00:00
|
|
|
}
|
|
|
|
</style>
|