Some style improvements
[vchess.git] / client / src / App.vue
CommitLineData
625022fd 1<template lang="pug">
98db2082 2#app
98db2082 3 Language
c66a829b 4 Settings
98db2082 5 ContactForm
c66a829b 6 UpsertUser
98db2082 7 .container
98db2082 8 .row
85e5b5c1
BA
9 .col-sm-12.col-md-10.col-md-offset-1.col-lg-8.col-lg-offset-2
10 // Menu (top of page):
5157ce0b 11 // Left: hall, variants, mygames
85e5b5c1
BA
12 // Right: usermenu, settings, flag
13 nav
14 label.drawer-toggle(for="drawerControl")
15 input#drawerControl.drawer(type="checkbox")
9a3049f3 16 #menuBar(@click="hideDrawer($event)")
85e5b5c1
BA
17 label.drawer-close(for="drawerControl")
18 #leftMenu
19 router-link(to="/")
cf2343ce 20 | {{ st.tr["Hall"] }}
85e5b5c1
BA
21 router-link(to="/variants")
22 | {{ st.tr["Variants"] }}
23 router-link(to="/mygames")
24 | {{ st.tr["My games"] }}
85e5b5c1
BA
25 #rightMenu
26 .clickable(onClick="doClick('modalUser')")
3837d4f7 27 | {{ st.user.id > 0 ? (st.user.name || "@nonymous") : "Login" }}
85e5b5c1
BA
28 .clickable(onClick="doClick('modalSettings')")
29 | {{ st.tr["Settings"] }}
fb54f098 30 .clickable#flagContainer(onClick="doClick('modalLang')")
03608482 31 img(v-if="!!st.lang" :src="flagImage")
fb54f098 32 router-view
ccd4a2b7 33 .row
85e5b5c1
BA
34 .col-sm-12.col-md-10.col-md-offset-1.col-lg-8.col-lg-offset-2
35 footer
92a523d1 36 router-link.menuitem(to="/about") {{ st.tr["About"] }}
ccd4a2b7 37 p.clickable(onClick="doClick('modalContact')")
92a523d1 38 | {{ st.tr["Contact"] }}
5157ce0b
BA
39 a.menuitem(href="https://forum.vchess.club")
40 | {{ st.tr["Forum"] }}
625022fd
BA
41</template>
42
98db2082 43<script>
98db2082
BA
44import ContactForm from "@/components/ContactForm.vue";
45import Language from "@/components/Language.vue";
46import Settings from "@/components/Settings.vue";
c66a829b
BA
47import UpsertUser from "@/components/UpsertUser.vue";
48import { store } from "./store.js";
dcd68c41 49import { processModalClick } from "./utils/modalClick.js";
98db2082 50export default {
98db2082
BA
51 components: {
52 ContactForm,
53 Language,
54 Settings,
c66a829b
BA
55 UpsertUser,
56 },
57 data: function() {
58 return {
59 st: store.state,
60 };
98db2082 61 },
03608482
BA
62 computed: {
63 flagImage: function() {
64 return `/images/flags/${this.st.lang}.svg`;
65 },
66 },
dcd68c41
BA
67 mounted: function() {
68 let dialogs = document.querySelectorAll("div[role='dialog']");
69 dialogs.forEach(d => {
70 d.addEventListener("click", processModalClick);
71 });
72 },
4f887105
BA
73 methods: {
74 hideDrawer: function(e) {
75 if (e.target.innerText == "Forum")
76 return; //external link
77 e.preventDefault(); //TODO: why is this needed?
78 document.getElementsByClassName("drawer")[0].checked = false;
79 },
80 },
98db2082
BA
81};
82</script>
83
625022fd 84<style lang="sass">
bc093771
BA
85html, *
86 font-family: "Open Sans", Arial, sans-serif
bc093771
BA
87 --a-link-color: black
88 --a-visited-color: black
dcd68c41
BA
89
90body
91 padding: 0
92 min-width: 320px
83c6c2c9
BA
93 --fore-color: #1c1e10 //#2c3e50
94 //--back-color: #f2f2f2
95 background-image: radial-gradient(white, #e6e6ff) //lavender)
dcd68c41 96
625022fd 97#app
625022fd
BA
98 -webkit-font-smoothing: antialiased
99 -moz-osx-font-smoothing: grayscale
625022fd 100
85e5b5c1 101.container
dcd68c41 102 overflow: hidden
85e5b5c1
BA
103 @media screen and (max-width: 767px)
104 padding: 0
105
fb54f098
BA
106.row > div
107 padding: 0
108
85e5b5c1
BA
109header
110 width: 100%
111 display: flex
112 align-items: center
113 justify-content: center
114 margin: 0 auto
115 & > img
116 width: 30px
117 height: 30px
118
119.clickable
120 cursor: pointer
121
dcd68c41
BA
122.text-center
123 text-align: center
124
dcd68c41
BA
125.clearer
126 clear: both
127
85e5b5c1
BA
128nav
129 width: 100%
fb54f098 130 margin: 0
85e5b5c1
BA
131 padding: 0
132 & > #menuBar
133 width: 100%
134 padding: 0
8c5f5390
BA
135 @media screen and (min-width: 768px)
136 & > #leftMenu
137 padding: 0
138 width: 50%
139 display: inline-flex
140 align-items: center
141 justify-content: flex-start
142 & > a
143 display: inline-block
144 color: #2c3e50
145 &.router-link-exact-active
146 color: #42b983
147 & > #rightMenu
148 padding: 0
149 width: 50%
150 display: inline-flex
151 align-items: center
152 justify-content: flex-end
153 & > div
154 display: inline-block
155 &#flagContainer
156 display: inline-flex
157 & > img
158 padding: 0
159 width: 36px
160 height: 27px
161 @media screen and (max-width: 767px)
162 & > #leftMenu
163 padding-bottom: 5px
164 & > a
165 color: #2c3e50
166 &.router-link-exact-active
167 color: #42b983
168 & > #rightMenu
169 padding-top: 5px
170 border-top: 1px solid darkgrey
171 & > div
172 &#flagContainer
173 display: inline-flex
174 & > img
175 padding: 0
176 width: 36px
177 height: 27px
85e5b5c1 178
430a2038
BA
179@media screen and (max-width: 767px)
180 nav
9936aac8 181 height: 32px
430a2038 182 border: none
57c8c2a6 183 & > label.drawer-toggle
9936aac8 184 font-size: 1.2rem
57c8c2a6 185 //padding: 0 0 0 10px
430a2038 186
85e5b5c1
BA
187[type="checkbox"].drawer+*
188 right: -767px
189
dcd68c41
BA
190@media screen and (max-width: 767px)
191 .button-group
192 flex-direction: row
193 button:not(:first-child)
194 border-left: 1px solid var(--button-group-border-color)
195 border-top: 0
196
85e5b5c1 197footer
5701c228 198 border: 1px solid #ddd
85e5b5c1
BA
199 //background-color: #000033
200 font-size: 1rem
201 width: 100%
a6b9b86c
BA
202 padding-left: 0
203 padding-right: 0
85e5b5c1
BA
204 display: inline-flex
205 align-items: center
206 justify-content: center
050ae3b5
BA
207 & > .router-link-exact-active
208 color: #42b983 !important
209 text-decoration: none
92a523d1 210 & > .menuitem
85e5b5c1 211 display: inline-block
5157ce0b 212 margin: 0 10px
85e5b5c1
BA
213 &:link
214 color: #2c3e50
5701c228
BA
215 &:visited, &:hover
216 color: #2c3e50
85e5b5c1
BA
217 text-decoration: none
218 & > p
219 display: inline-block
5157ce0b 220 margin: 0 10px
430a2038
BA
221
222@media screen and (max-width: 767px)
223 footer
224 border: none
625022fd 225</style>