-
Notifications
You must be signed in to change notification settings - Fork 38
/
MainViewController.vue
87 lines (79 loc) · 1.96 KB
/
MainViewController.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<template>
<div :class="$style.container">
<div :class="$style.headerContainer">
<main-view-header :channel-id="channelId" />
</div>
<div :class="$style.layoutContainer" :data-layout="state.layout">
<main-view-component-selector
:class="[$style.componentContainer, $style.primary]"
:view-info="state.primary"
/>
<main-view-component-selector
:class="[$style.componentContainer, $style.secondary]"
:view-info="state.secondary"
/>
</div>
</div>
</template>
<script lang="ts">
import { defineComponent, reactive, computed } from '@vue/composition-api'
import store from '@/store'
import MainViewComponentSelector from './MainViewComponentSelector.vue'
import MainViewHeader from './MainViewHeader/MainViewHeader.vue'
export default defineComponent({
name: 'MainViewController',
components: { MainViewComponentSelector, MainViewHeader },
setup() {
const state = reactive({
layout: computed(() => store.state.ui.mainView.layout),
primary: computed(() => store.state.ui.mainView.primaryView),
secondary: computed(() => store.state.ui.mainView.secondaryView)
})
const channelId = computed(
() => store.state.domain.messagesView.currentChannelId
)
return {
state,
channelId
}
}
})
</script>
<style lang="scss" module>
$headerHeight: 80px;
.container {
height: 100%;
position: relative;
display: flex;
flex-direction: column;
}
.componentContainer {
height: 100%;
}
.headerContainer {
height: $headerHeight;
width: 100%;
flex: 0 0 $headerHeight;
}
// レイアウト系
.layoutContainer {
height: 100%;
min-height: 0;
display: flex;
flex-direction: column;
&[data-layout='single'] {
.secondary {
display: none;
}
}
&[data-layout|='split'] {
display: flex;
}
&[data-layout='split'] {
flex-direction: column;
}
&[data-layout='split-reverse'] {
flex-direction: column-reverse;
}
}
</style>