Skip to content

Commit cc8de9a

Browse files
committed
📲 responsive design
1 parent d97dd24 commit cc8de9a

11 files changed

+153
-22
lines changed

package-lock.json

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"ol": "^6.1.1",
1212
"proj4": "^2.6.0",
1313
"vue": "^2.6.10",
14+
"vue-burger-menu": "^2.0.3",
1415
"vue-code-highlight": "^0.7.4",
1516
"vue-router": "^3.1.3"
1617
},

src/assets/css/styles.css

+44-5
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,13 @@ body {
99
/* Base layout in App.vue */
1010
#app {
1111
display: grid;
12-
grid-template-columns: 1fr 1fr 1fr 1fr 1fr;
12+
grid-template-columns: repeat(5, 1fr);
1313
grid-template-rows: auto;
1414
grid-template-areas:
1515
"header header header header header"
1616
"navbar map map map map"
1717
}
1818

19-
2019
.header {
2120
grid-area: header;
2221
background-color: black;
@@ -30,7 +29,7 @@ body {
3029
}
3130

3231
.header h1 {
33-
font-size: 2vw;
32+
font-size: larger;
3433
padding: 10px;
3534
}
3635

@@ -80,7 +79,7 @@ body {
8079
.navbar-item {
8180
color: white;
8281
text-decoration: none; /* Remove underline from links */
83-
font-size:1vw
82+
font-size:1vw;
8483
}
8584

8685
.router-link-active{
@@ -94,6 +93,8 @@ body {
9493
margin: auto;
9594
}
9695

96+
97+
9798
/* Higthliting code */
9899
.map-code {
99100
width: 80%;
@@ -105,7 +106,7 @@ body {
105106
padding: 2em 0 2em 0;
106107
width: 80%;
107108
margin: auto;
108-
font-size:1vw;
109+
font-size:medium;
109110
line-height: 1.3;
110111
}
111112

@@ -130,3 +131,41 @@ body {
130131
.openlayers-link {
131132
color: #d63200;
132133
}
134+
135+
/*responsive design*/
136+
@media (max-width: 1024px) {
137+
#app {
138+
display: grid;
139+
grid-template-columns: repeat(5, 1fr);
140+
grid-template-rows: auto;
141+
grid-template-areas:
142+
"header header header header header"
143+
"map map map map map"
144+
}
145+
146+
#map {
147+
width: 95%;
148+
margin: auto;
149+
height: 20em;
150+
}
151+
152+
.description {
153+
padding: 2em 0 2em 0;
154+
width: 90%;
155+
font-size: small;
156+
margin: auto;
157+
}
158+
159+
.map-code {
160+
width: 100%;
161+
margin: auto;
162+
font-size: small;
163+
}
164+
165+
.header {
166+
height: 2em;
167+
}
168+
.header h1 {
169+
font-size: small;
170+
}
171+
}

src/components/TheHeader.vue

+38-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,47 @@
11
<template>
22
<div>
3+
<Slide right>
4+
<router-link class="navbar-item" :to="{name: 'home'}">Accueil</router-link>
5+
<router-link class="navbar-item" :to="{name: 'firstMap'}">Afficher une carte</router-link>
6+
<router-link class="navbar-item" :to="{name: 'changeView'}">Centrer la carte</router-link>
7+
<router-link class="navbar-item" :to="{name: 'projections'}">Utiliser des projections différentes</router-link>
8+
<router-link class="navbar-item" :to="{name: 'controles'}">Afficher les contrôles disponibles</router-link>
9+
<router-link class="navbar-item" :to="{name: 'tileMap'}">Les sources de couche OpenLayers</router-link>
10+
<router-link class="navbar-item" :to="{name: 'rasterTiles'}">Les tuiles raster OpenStreetMap</router-link>
11+
<router-link class="navbar-item" :to="{name: 'mapEvent'}">Les évènements liés à la carte</router-link>
12+
<router-link class="navbar-item" :to="{name: 'vectorGeometry'}">Créer des géométries</router-link>
13+
<router-link class="navbar-item" :to="{name: 'vectorFile'}">Charger des fichiers de données</router-link>
14+
<router-link class="navbar-item" :to="{name: 'vectorData'}">Manipuler des données vectorielles</router-link>
15+
<router-link class="navbar-item" :to="{name: 'overlays'}">Afficher un overlay</router-link>
16+
<router-link class="navbar-item" :to="{name: 'multipleOverlays'}">Afficher plusieurs overlays</router-link>
17+
<router-link class="navbar-item" :to="{name: 'popup'}">Afficher des infos dans une popup</router-link>
18+
</Slide>
319
<h1><span class="vue">Vue.js</span> + <span class="openlayers">OpenLayers 6</span> 🌍</h1>
420
</div>
521
</template>
622

723
<script>
24+
import { Slide } from 'vue-burger-menu'
25+
import TheNavBar from './TheNavBar'
826
export default {
9-
27+
components: {
28+
Slide,
29+
TheNavBar
30+
},
1031
}
11-
</script>
32+
</script>
33+
34+
<style>
35+
.bm-burger-bars {
36+
background-color:white;
37+
}
38+
.bm-burger-button {
39+
width: 1em;
40+
height: 1em;
41+
left: 0px;
42+
top: 5px;
43+
}
44+
.bm-item-list a {
45+
font-size: small;
46+
}
47+
</style>

src/pages/PageHome.vue

+7
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,11 @@ a {
5858
i {
5959
font-size: 1.5em;
6060
}
61+
62+
@media (max-width: 1024px) {
63+
.backdrop-home {
64+
font-size: smaller;
65+
width: 70%;
66+
}
67+
}
6168
</style>

src/pages/PageMultipleOverlays.vue

+8-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ export default {
9090
target: 'map',
9191
view: new View({
9292
center: [0, 0],
93-
zoom: 2
93+
zoom: 0
9494
})
9595
})
9696
@@ -121,6 +121,13 @@ export default {
121121
margin: auto;
122122
}
123123
124+
@media (max-width: 1024px) {
125+
#map {
126+
width: 95%;
127+
margin: auto;
128+
}
129+
}
130+
124131
.mount {
125132
width: 15px;
126133
height: 15px;

src/pages/PageOverlays.vue

+7
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,13 @@ export default {
7777
margin: auto;
7878
}
7979
80+
@media (max-width: 1024px) {
81+
#map {
82+
width: 95%;
83+
margin: auto;
84+
}
85+
}
86+
8087
#marker {
8188
width: 20px;
8289
height: 20px;

src/pages/PagePopup.vue

-5
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,6 @@ export default {
139139
</script>
140140

141141
<style scoped>
142-
#map {
143-
height: 80vh;
144-
width: 80%;
145-
margin: auto;
146-
}
147142
148143
.ol-popup {
149144
position: absolute;

src/pages/PageProjections.vue

+1-9
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,4 @@ export default {
7171
}
7272
}
7373
74-
</script>
75-
76-
<style scoped>
77-
#map {
78-
height: 80vh;
79-
width: 80%;
80-
margin: auto;
81-
}
82-
</style>
74+
</script>

src/pages/PageRasterTiles.vue

+20
Original file line numberDiff line numberDiff line change
@@ -219,4 +219,24 @@ h2 {
219219
padding-bottom: 1.5em;
220220
font-size: 1.5em;
221221
}
222+
223+
@media (max-width: 1024px) {
224+
.content {
225+
display: block;
226+
}
227+
h2 {
228+
padding-bottom: 0;
229+
font-size: small;
230+
}
231+
.sidebar {
232+
font-size: small;
233+
padding: 0em 0em 0em 1em;
234+
}
235+
#map {
236+
width: 95%;
237+
margin: auto;
238+
height: 20em;
239+
}
240+
}
241+
222242
</style>

src/pages/PageTileMap.vue

+19
Original file line numberDiff line numberDiff line change
@@ -194,4 +194,23 @@ h2 {
194194
margin: auto;
195195
}
196196
197+
@media (max-width: 1024px) {
198+
.content {
199+
display: block;
200+
}
201+
h2 {
202+
padding-bottom: 0;
203+
font-size: small;
204+
}
205+
.sidebar {
206+
font-size: small;
207+
padding: 0em 0em 0em 1em;
208+
}
209+
#map {
210+
width: 95%;
211+
margin: auto;
212+
height: 20em;
213+
}
214+
}
215+
197216
</style>

0 commit comments

Comments
 (0)