Better margin on smartphones for preset challenges
[vchess.git] / client / src / App.vue
CommitLineData
625022fd 1<template lang="pug">
98db2082 2#app
c66a829b 3 Settings
98db2082 4 ContactForm
c66a829b 5 UpsertUser
98db2082 6 .container
98db2082 7 .row
85e5b5c1
BA
8 .col-sm-12.col-md-10.col-md-offset-1.col-lg-8.col-lg-offset-2
9 // Menu (top of page):
89021f18 10 // Left: hall, variants, problems, mygames
5b3dc10e 11 // Right: usermenu, settings
85e5b5c1
BA
12 nav
13 label.drawer-toggle(for="drawerControl")
14 input#drawerControl.drawer(type="checkbox")
9a3049f3 15 #menuBar(@click="hideDrawer($event)")
85e5b5c1
BA
16 label.drawer-close(for="drawerControl")
17 #leftMenu
18 router-link(to="/")
cf2343ce 19 | {{ st.tr["Hall"] }}
ae2c49bb
BA
20 router-link(to="/mygames")
21 | {{ st.tr["My games"] }}
85e5b5c1
BA
22 router-link(to="/variants")
23 | {{ st.tr["Variants"] }}
89021f18
BA
24 router-link(to="/problems")
25 | {{ st.tr["Problems"] }}
85e5b5c1 26 #rightMenu
910d631b 27 .clickable(onClick="window.doClick('modalUser')")
3837d4f7 28 | {{ st.user.id > 0 ? (st.user.name || "@nonymous") : "Login" }}
5b3dc10e
BA
29 #divSettings.clickable(onClick="window.doClick('modalSettings')")
30 span {{ st.tr["Settings"] }}
b9a5fe01 31 img(src="/images/icons/settings.svg")
fb54f098 32 router-view
604b951e
BA
33 .row
34 .col-sm-12.col-md-10.col-md-offset-1.col-lg-8.col-lg-offset-2
35 footer
36 router-link.menuitem(to="/about") {{ st.tr["About"] }}
b6a37c07 37 a.menuitem(href="https://discord.gg/a9ZFKBe") Discord
604b951e 38 router-link.menuitem(to="/news") {{ st.tr["News"] }}
910d631b 39 p.clickable(onClick="window.doClick('modalContact')")
604b951e 40 | {{ st.tr["Contact"] }}
625022fd
BA
41</template>
42
98db2082 43<script>
98db2082 44import ContactForm from "@/components/ContactForm.vue";
98db2082 45import Settings from "@/components/Settings.vue";
c66a829b
BA
46import UpsertUser from "@/components/UpsertUser.vue";
47import { store } from "./store.js";
dcd68c41 48import { processModalClick } from "./utils/modalClick.js";
98db2082 49export default {
98db2082
BA
50 components: {
51 ContactForm,
98db2082 52 Settings,
6808d7a1 53 UpsertUser
c66a829b
BA
54 },
55 data: function() {
56 return {
6808d7a1 57 st: store.state
c66a829b 58 };
98db2082 59 },
dcd68c41
BA
60 mounted: function() {
61 let dialogs = document.querySelectorAll("div[role='dialog']");
62 dialogs.forEach(d => {
63 d.addEventListener("click", processModalClick);
64 });
65 },
4f887105
BA
66 methods: {
67 hideDrawer: function(e) {
4f887105
BA
68 e.preventDefault(); //TODO: why is this needed?
69 document.getElementsByClassName("drawer")[0].checked = false;
6808d7a1
BA
70 }
71 }
98db2082
BA
72};
73</script>
74
625022fd 75<style lang="sass">
bc093771
BA
76html, *
77 font-family: "Open Sans", Arial, sans-serif
bc093771
BA
78 --a-link-color: black
79 --a-visited-color: black
dcd68c41
BA
80
81body
82 padding: 0
83 min-width: 320px
83c6c2c9
BA
84 --fore-color: #1c1e10 //#2c3e50
85 //--back-color: #f2f2f2
86 background-image: radial-gradient(white, #e6e6ff) //lavender)
dcd68c41 87
625022fd 88#app
625022fd
BA
89 -webkit-font-smoothing: antialiased
90 -moz-osx-font-smoothing: grayscale
625022fd 91
85e5b5c1 92.container
604b951e
BA
93 // 45px is footer height
94 min-height: calc(100vh - 45px)
dcd68c41 95 overflow: hidden
bd76b456
BA
96 padding: 0
97 margin: 0
85e5b5c1 98
fb54f098
BA
99.row > div
100 padding: 0
101
85e5b5c1
BA
102header
103 width: 100%
104 display: flex
105 align-items: center
106 justify-content: center
107 margin: 0 auto
85e5b5c1
BA
108
109.clickable
110 cursor: pointer
111
dcd68c41
BA
112.text-center
113 text-align: center
114
a17ae317
BA
115.bold
116 font-weight: bold
117
dcd68c41
BA
118.clearer
119 clear: both
120
bd76b456
BA
121.button-group
122 margin: 0
123
124input[type="checkbox"]:focus
125 outline: 0
126
127input[type=checkbox]:checked:before
128 top: -5px;
129 height: 18px
130
131table
132 display: block
133 padding: 0
134 tr > td
135 cursor: pointer
136 th, td
137 padding: 5px
138
5b3dc10e
BA
139#divSettings
140 padding: 0 10px 0 0
141 height: 100%
142 & > span
143 vertical-align: middle
144 & > img
145 padding: 0
146 height: 24px
147 vertical-align: middle
148
bd76b456
BA
149@media screen and (max-width: 767px)
150 table
151 tr > th, td
152 font-size: 14px
153
85e5b5c1
BA
154nav
155 width: 100%
fb54f098 156 margin: 0
85e5b5c1
BA
157 padding: 0
158 & > #menuBar
159 width: 100%
160 padding: 0
8c5f5390
BA
161 @media screen and (min-width: 768px)
162 & > #leftMenu
163 padding: 0
164 width: 50%
165 display: inline-flex
166 align-items: center
167 justify-content: flex-start
168 & > a
169 display: inline-block
170 color: #2c3e50
171 &.router-link-exact-active
172 color: #42b983
173 & > #rightMenu
174 padding: 0
175 width: 50%
176 display: inline-flex
177 align-items: center
178 justify-content: flex-end
179 & > div
180 display: inline-block
8c5f5390
BA
181 @media screen and (max-width: 767px)
182 & > #leftMenu
bd76b456 183 margin-top: 42px
8c5f5390
BA
184 padding-bottom: 5px
185 & > a
186 color: #2c3e50
187 &.router-link-exact-active
188 color: #42b983
189 & > #rightMenu
190 padding-top: 5px
191 border-top: 1px solid darkgrey
85e5b5c1 192
430a2038
BA
193@media screen and (max-width: 767px)
194 nav
bd76b456 195 height: 42px
430a2038 196 border: none
57c8c2a6 197 & > label.drawer-toggle
bd76b456 198 cursor: pointer
89021f18 199 position: absolute
57eb158f
BA
200 top: 0
201 left: 5px
202 line-height: 42px
203 height: 42px
b5aa30b5 204 padding: 0
57eb158f
BA
205 & > label.drawer-toggle:before
206 font-size: 42px
c6913dbc
BA
207 & > #menuBar
208 z-index: 5000 //to hide currently selected piece if any
430a2038 209
85e5b5c1
BA
210[type="checkbox"].drawer+*
211 right: -767px
212
bd76b456 213[type=checkbox].drawer+* .drawer-close
b5aa30b5 214 top: 0
57eb158f 215 left: 5px
b5aa30b5 216 padding: 0
57eb158f
BA
217 height: 50px
218 width: 50px
219 line-height: 50px
bd76b456
BA
220
221[type=checkbox].drawer+* .drawer-close:before
222 font-size: 50px
223
dcd68c41
BA
224@media screen and (max-width: 767px)
225 .button-group
226 flex-direction: row
227 button:not(:first-child)
228 border-left: 1px solid var(--button-group-border-color)
229 border-top: 0
230
85e5b5c1 231footer
604b951e 232 height: 45px
5701c228 233 border: 1px solid #ddd
604b951e 234 box-sizing: border-box
85e5b5c1
BA
235 //background-color: #000033
236 font-size: 1rem
237 width: 100%
604b951e 238 padding: 0
85e5b5c1
BA
239 display: inline-flex
240 align-items: center
241 justify-content: center
050ae3b5
BA
242 & > .router-link-exact-active
243 color: #42b983 !important
244 text-decoration: none
92a523d1 245 & > .menuitem
85e5b5c1 246 display: inline-block
604b951e 247 margin: 0 12px
85e5b5c1
BA
248 &:link
249 color: #2c3e50
5701c228
BA
250 &:visited, &:hover
251 color: #2c3e50
85e5b5c1
BA
252 text-decoration: none
253 & > p
254 display: inline-block
604b951e 255 margin: 0 12px
430a2038
BA
256
257@media screen and (max-width: 767px)
258 footer
259 border: none
89021f18
BA
260
261// Styles for diagrams and board (partial).
262// TODO: where to put that ?
263
264.light-square-diag
265 background-color: #e5e5ca
266
267.dark-square-diag
268 background-color: #6f8f57
269
270div.board
271 float: left
272 height: 0
273 display: inline-block
274 position: relative
275
276div.board8
277 width: 12.5%
278 padding-bottom: 12.5%
279
280div.board10
281 width: 10%
282 padding-bottom: 10%
283
284div.board11
285 width: 9.09%
286 padding-bottom: 9.1%
287
288img.piece
289 width: 100%
290
291img.piece, img.mark-square
292 max-width: 100%
293 height: auto
294 display: block
295
296img.mark-square
297 opacity: 0.6
298 width: 76%
299 position: absolute
300 top: 12%
301 left: 12%
302 opacity: .7
303
304.in-shadow
305 filter: brightness(50%)
625022fd 306</style>