11<template >
22 <div >
3- <div class =" app-container" >
3+ <div
4+ class =" app-container"
5+ :class =" { 'app-mobile': isDevice, 'app-mobile-dark': theme === 'dark' }"
6+ >
47 <!-- <div>
58 <button @click="resetData">Clear Data</button>
69 <button @click="addData" :disabled="updatingData">Add Data</button>
710 </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" >
1019 <option v-for =" user in users" :key =" user._id" :value =" user._id" >
1120 {{ user.username }}
1221 </option >
1322 </select >
1423
15- <div class =" button-theme" v-if =" !isDevice " >
24+ <div class =" button-theme" v-if =" showOptions " >
1625 <button @click =" theme = 'light'" class =" button-light" >Light</button >
1726 <button @click =" theme = 'dark'" class =" button-dark" >Dark</button >
1827 </div >
2130 :currentUserId =" currentUserId"
2231 :theme =" theme"
2332 :isDevice =" isDevice"
33+ @show-demo-options =" showDemoOptions = $event"
2434 v-if =" showChat"
2535 />
2636
@@ -63,10 +73,19 @@ export default {
6373 }
6474 ],
6575 currentUserId: ' 6R0MijpK6M4AIrwaaCY2' ,
76+ isDevice: false ,
77+ showDemoOptions: true ,
6678 updatingData: false
6779 }
6880 },
6981
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+
7089 watch: {
7190 currentUserId () {
7291 this .showChat = false
@@ -75,8 +94,8 @@ export default {
7594 },
7695
7796 computed: {
78- isDevice () {
79- return window . innerWidth < 500
97+ showOptions () {
98+ return ! this . isDevice || this . showDemoOptions
8099 }
81100 },
82101
@@ -142,28 +161,54 @@ body {
142161 margin : 0 ;
143162}
144163
164+ input {
165+ -webkit-appearance : none ;
166+ }
167+
145168.app-container {
146169 font-family : ' Quicksand' , sans-serif ;
147170 padding : 20px 30px 30px ;
171+ }
172+
173+ .app-mobile {
174+ padding : 0 ;
148175
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 ;
151200 }
152201}
153202
154203select {
155204 height : 20px ;
156205 outline : none ;
157206 border : 1px solid #e0e2e4 ;
207+ border-radius : 4px ;
158208 background : #fff ;
159209 margin-bottom : 20px ;
160210}
161211
162- .user-logged {
163- font-size : 12px ;
164- margin-right : 5px ;
165- }
166-
167212.button-theme {
168213 float : right ;
169214
0 commit comments