1
1
<template >
2
2
<div >
3
- <div class =" app-container" >
3
+ <div
4
+ class =" app-container"
5
+ :class =" { 'app-mobile': isDevice, 'app-mobile-dark': theme === 'dark' }"
6
+ >
4
7
<!-- <div>
5
8
<button @click="resetData">Clear Data</button>
6
9
<button @click="addData" :disabled="updatingData">Add Data</button>
7
10
</div> -->
8
- <span class =" user-logged" v-if =" !isDevice" >Logged as</span >
9
- <select v-model =" currentUserId" v-if =" !isDevice" >
11
+ <span
12
+ class =" user-logged"
13
+ :class =" { 'user-logged-dark': theme === 'dark' }"
14
+ v-if =" showOptions"
15
+ >
16
+ Logged as
17
+ </span >
18
+ <select v-model =" currentUserId" v-if =" showOptions" >
10
19
<option v-for =" user in users" :key =" user._id" :value =" user._id" >
11
20
{{ user.username }}
12
21
</option >
13
22
</select >
14
23
15
- <div class =" button-theme" v-if =" !isDevice " >
24
+ <div class =" button-theme" v-if =" showOptions " >
16
25
<button @click =" theme = 'light'" class =" button-light" >Light</button >
17
26
<button @click =" theme = 'dark'" class =" button-dark" >Dark</button >
18
27
</div >
21
30
:currentUserId =" currentUserId"
22
31
:theme =" theme"
23
32
:isDevice =" isDevice"
33
+ @show-demo-options =" showDemoOptions = $event"
24
34
v-if =" showChat"
25
35
/>
26
36
@@ -63,10 +73,19 @@ export default {
63
73
}
64
74
],
65
75
currentUserId: ' 6R0MijpK6M4AIrwaaCY2' ,
76
+ isDevice: false ,
77
+ showDemoOptions: true ,
66
78
updatingData: false
67
79
}
68
80
},
69
81
82
+ mounted () {
83
+ this .isDevice = window .innerWidth < 500
84
+ window .addEventListener (' resize' , ev => {
85
+ if (ev .isTrusted ) this .isDevice = window .innerWidth < 500
86
+ })
87
+ },
88
+
70
89
watch: {
71
90
currentUserId () {
72
91
this .showChat = false
@@ -75,8 +94,8 @@ export default {
75
94
},
76
95
77
96
computed: {
78
- isDevice () {
79
- return window . innerWidth < 500
97
+ showOptions () {
98
+ return ! this . isDevice || this . showDemoOptions
80
99
}
81
100
},
82
101
@@ -142,28 +161,54 @@ body {
142
161
margin : 0 ;
143
162
}
144
163
164
+ input {
165
+ -webkit-appearance : none ;
166
+ }
167
+
145
168
.app-container {
146
169
font-family : ' Quicksand' , sans-serif ;
147
170
padding : 20px 30px 30px ;
171
+ }
172
+
173
+ .app-mobile {
174
+ padding : 0 ;
148
175
149
- @media only screen and (max-width : 768px ) {
150
- padding : 0 ;
176
+ & .app-mobile-dark {
177
+ background : #131415 ;
178
+ }
179
+
180
+ .user-logged {
181
+ margin : 10px 5px 0 10px ;
182
+ }
183
+
184
+ select {
185
+ margin : 10px 0 ;
186
+ }
187
+
188
+ .button-theme {
189
+ margin : 10px 10px 0 0 ;
190
+ }
191
+ }
192
+
193
+ .user-logged {
194
+ font-size : 12px ;
195
+ margin-right : 5px ;
196
+ margin-top : 10px ;
197
+
198
+ & .user-logged-dark {
199
+ color : #fff ;
151
200
}
152
201
}
153
202
154
203
select {
155
204
height : 20px ;
156
205
outline : none ;
157
206
border : 1px solid #e0e2e4 ;
207
+ border-radius : 4px ;
158
208
background : #fff ;
159
209
margin-bottom : 20px ;
160
210
}
161
211
162
- .user-logged {
163
- font-size : 12px ;
164
- margin-right : 5px ;
165
- }
166
-
167
212
.button-theme {
168
213
float : right ;
169
214
0 commit comments