traxxx/assets/components/container/container.vue

82 lines
1.3 KiB
Vue
Raw Normal View History

<template>
2020-05-25 00:02:28 +00:00
<div
class="container"
:class="theme"
>
2020-08-08 13:33:51 +00:00
<Sidebar v-model="showSidebar" />
<SidebarBackground v-model="showSidebar" />
2020-05-25 00:02:28 +00:00
<Header :toggle-sidebar="toggleSidebar" />
2020-05-25 00:02:28 +00:00
<div class="content">
<!-- key forces rerender when new and old path use same component -->
<router-view />
</div>
</div>
</template>
<script>
2020-03-23 00:43:49 +00:00
import { mapState } from 'vuex';
import Header from '../header/header.vue';
import Sidebar from '../sidebar/sidebar.vue';
2020-08-08 13:33:51 +00:00
import SidebarBackground from '../sidebar/background.vue';
2020-03-23 00:43:49 +00:00
function theme(state) {
2020-05-25 00:02:28 +00:00
return state.ui.theme;
2020-03-23 00:43:49 +00:00
}
function toggleSidebar(state) {
2020-05-25 00:02:28 +00:00
this.showSidebar = typeof state === 'boolean' ? state : !this.showSidebar;
}
export default {
2020-05-25 00:02:28 +00:00
components: {
Header,
2020-08-08 13:33:51 +00:00
Sidebar,
SidebarBackground
2020-05-25 00:02:28 +00:00
},
data() {
return {
showSidebar: false,
};
},
computed: {
...mapState({
theme,
}),
},
methods: {
toggleSidebar,
},
};
</script>
<style lang="scss">
2019-11-14 00:18:19 +00:00
@import 'theme';
.container {
position: relative;
height: 100%;
display: flex;
flex-direction: column;
overflow: hidden;
2020-05-25 00:02:28 +00:00
background: var(--background-soft);
color: var(--text);
}
.content {
display: flex;
flex-direction: column;
flex-grow: 1;
2019-11-14 00:18:19 +00:00
overflow-y: auto;
2020-06-29 23:07:48 +00:00
overflow-x: hidden;
}
.content-inner {
2020-06-27 02:50:13 +00:00
flex-grow: 1;
overflow-y: auto;
overflow-x: hidden;
}
</style>