1 | <template>
|
2 | <div id="fakeBody" :class="{ 'fakeBody--max': !isSidebarShown }">
|
3 | <div class="header">
|
4 | <a
|
5 | class="header-logo"
|
6 | :href="config.homePage || '#'"
|
7 | target="_blank"
|
8 | :style="{ backgroundImage: `url(${config.logo})` }"
|
9 | >
|
10 | {{ config.logo ? '' : config.name }}
|
11 | </a>
|
12 | <span v-if="config.version" class="header-version">
|
13 | {{ config.version }}
|
14 | </span>
|
15 | </div>
|
16 | <sidebar class="sidebar"></sidebar>
|
17 | <router-view class="vessel"></router-view>
|
18 | <div
|
19 | class="handler"
|
20 | :class="{
|
21 | 'handler--hidden': !isSidebarShown
|
22 | }"
|
23 | @click="TOGGLE_SIDEBAR"
|
24 | ></div>
|
25 | </div>
|
26 | </template>
|
27 |
|
28 | <script>
|
29 | import { mapState, mapActions, mapMutations } from 'vuex';
|
30 | import Sidebar from '@/components/sidebar.vue';
|
31 | export default {
|
32 | name: 'fakeBody',
|
33 | components: {
|
34 | Sidebar
|
35 | },
|
36 | mounted() {
|
37 | window.test = this;
|
38 | },
|
39 | computed: {
|
40 | ...mapState(['config', 'isSidebarShown'])
|
41 | },
|
42 | methods: {
|
43 | ...mapActions(['setBoxes']),
|
44 | ...mapMutations(['TOGGLE_SIDEBAR'])
|
45 | }
|
46 | };
|
47 | </script>
|
48 |
|
49 | <style lang="scss">
|
50 | @import '~@/css/index.scss';
|
51 | #fakeBody {
|
52 | position: relative;
|
53 | width: 100%;
|
54 | height: 100vh;
|
55 | background-color: $c-gap;
|
56 | display: grid;
|
57 | grid-gap: 1px;
|
58 | overflow: hidden;
|
59 | grid-template: 60px 1fr / 250px repeat(2, 1fr);
|
60 | &.fakeBody--max {
|
61 | grid-template: 60px 1fr / 0px repeat(2, 1fr);
|
62 | }
|
63 | }
|
64 | .header {
|
65 | display: flex;
|
66 | box-sizing: border-box;
|
67 | padding: 0 20px;
|
68 | font-family: $link-font-family;
|
69 | grid-column: 1 / 2;
|
70 | grid-row: 1 / 2;
|
71 | transition: 0.6s all ease-out;
|
72 | text-decoration: none;
|
73 | background-color: $c-bg;
|
74 | &-logo {
|
75 | font-family: $logo-font-family;
|
76 | flex-grow: 1;
|
77 | text-align: left;
|
78 | cursor: pointer;
|
79 | background-size: contain;
|
80 | background-repeat: no-repeat;
|
81 | background-position: left center;
|
82 | line-height: 60px;
|
83 | text-decoration: none;
|
84 | }
|
85 | &-version {
|
86 | width: 4em;
|
87 | text-align: right;
|
88 | pointer-events: none;
|
89 | line-height: 60px;
|
90 | }
|
91 | &:hover {
|
92 | filter: brightness(1.2);
|
93 | transition-duration: 0.2s;
|
94 | }
|
95 | }
|
96 | .sidebar {
|
97 | grid-column: 1 / 2;
|
98 | grid-row: 2 / -1;
|
99 | background-color: $c-bg;
|
100 | }
|
101 | .handler {
|
102 | position: absolute;
|
103 | width: 12px;
|
104 | height: 40px;
|
105 | background: rgba(#000, 0.3);
|
106 | left: 240px;
|
107 | top: 50%;
|
108 | transform: translateY(-50%);
|
109 | opacity: 0.5;
|
110 | cursor: pointer;
|
111 | &--hidden {
|
112 | left: 0;
|
113 | }
|
114 | &:hover {
|
115 | opacity: 1;
|
116 | }
|
117 | &:active {
|
118 | opacity: 0.8;
|
119 | }
|
120 | &::after,
|
121 | &::before {
|
122 | content: '';
|
123 | position: absolute;
|
124 | width: 1px;
|
125 | height: 30px;
|
126 | top: 5px;
|
127 | left: 3px;
|
128 | background: rgba(#fff, 0.3);
|
129 | }
|
130 | &::after {
|
131 | left: 7px;
|
132 | }
|
133 | }
|
134 | .vessel {
|
135 | grid-column: 2 / -1;
|
136 | grid-row: 1 / -1;
|
137 | transition: 0.3s all ease-out;
|
138 | }
|
139 |
|
140 | @media (max-width: $c-small-screen) {
|
141 | #fakeBody {
|
142 | grid-template: 60px 1fr / repeat(12, 1fr);
|
143 | &.fakeBody--max {
|
144 | grid-template: 60px 1fr / repeat(2, 1fr);
|
145 | & .sidebar,
|
146 | .header {
|
147 | display: none;
|
148 | }
|
149 | & .vessel {
|
150 | grid-column: 1 / -1;
|
151 | grid-row: 1 / -1;
|
152 | }
|
153 | }
|
154 | & .sidebar {
|
155 | grid-column: 1 / 2;
|
156 | grid-row: 1 / 2;
|
157 | }
|
158 | & .header {
|
159 | grid-column: 2 / -1;
|
160 | grid-row: 1 / 2;
|
161 | }
|
162 | & .vessel {
|
163 | grid-column: 1 / -1;
|
164 | grid-row: 2 / -1;
|
165 | }
|
166 | & .handler {
|
167 | left: 50%;
|
168 | top: 48px;
|
169 | transform: translateY(-50%) rotate(90deg);
|
170 | transform-origin: left center;
|
171 | &--hidden {
|
172 | top: 0px;
|
173 | }
|
174 | }
|
175 | }
|
176 | }
|
177 | </style>
|