Skip to content

Commit 08d46fc

Browse files
committed
Make LocaleChooser responsive
Positioning of LocaleChooser is updated with css grid properties. This PR updates styling of the App and LocaleChooser components to be mobile-first.
1 parent 856cbc0 commit 08d46fc

File tree

2 files changed

+65
-80
lines changed

2 files changed

+65
-80
lines changed

src/App.vue

+25-37
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
{{ $t('select-license.instructions') }}
1515
</p>
1616
</div>
17-
<LocaleChooser />
17+
<LocaleChooser class="locale-chooser" />
1818
</div>
1919
<div class="columns">
2020
<Stepper v-model="currentStepId" />
@@ -112,19 +112,19 @@ export default {
112112
counter-reset: step-counter;
113113
}
114114
#site-container {
115-
padding-top: 2rem;
116-
padding-bottom: 2%;
115+
padding: 0.75rem;
117116
}
118117
.page-head {
119118
display: grid;
120-
grid-template-columns: repeat(2, 1fr);
119+
grid-template-columns: 1fr;
121120
grid-gap: 1.5rem;
122-
.select-license-column {
123-
grid-column: 1;
124-
}
125-
.locale-chooser {
126-
grid-column: 2;
127-
}
121+
grid-template-areas: "localechooser" "heading";
122+
}
123+
.selected-license-column {
124+
grid-area: heading;
125+
}
126+
.locale-chooser {
127+
grid-area: localechooser;
128128
}
129129
.stepper-instructions {
130130
margin-bottom: 14px;
@@ -134,43 +134,31 @@ export default {
134134
top: 10px;
135135
}
136136
.selected-license-card {
137-
// Margin is added to make the left column long enough for the right column to stay sticky when scrolling
137+
// Margin is added to make the left column long enough
138+
// for the right column to stay sticky when scrolling
138139
margin-bottom: 32px;
139140
}
140-
@media only screen and (max-width: 1025px) {
141-
#site-container {
142-
margin-left: 2%;
143-
margin-right: 2%;
144-
}
145-
.mobile-hide {
146-
display: none;
147-
}
148-
.mobile-show {
149-
display: block;
150-
}
141+
footer.footer.chooser-footer {
142+
margin-top: 2rem;
151143
}
152-
@media only screen and (max-width: 768px) {
144+
@media only screen and (min-width: 769px) {
153145
#site-container {
154-
padding-top: 0;
146+
padding-top: 2rem;
155147
}
156148
.page-head {
157-
grid-template-columns: 100%;
158-
grid-gap: 1rem;
149+
grid-template-columns: 1fr 1fr;
150+
grid-gap: 1.5rem;
151+
grid-template-areas: "heading localechooser";
159152
}
160-
.select-license-column {
161-
order: 2;
162-
}
163-
.locale-chooser {
164-
padding-top: 1rem;
165-
height: auto;
166-
grid-column: auto;
167-
order: 1;
153+
footer {
154+
margin-top: 5rem;
168155
}
169156
}
170-
@media only screen and (max-width: 670px) {
157+
@media only screen and (min-width: 1025px) {
171158
#site-container {
172-
margin-left: 3%;
173-
margin-right: 3%;
159+
padding-left: 0;
160+
padding-right: 0;
174161
}
175162
}
163+
176164
</style>

src/components/LocaleChooser.vue

+40-43
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<div class="locale-chooser">
2+
<div>
33
<b-field
44
:label="this.$t('locale-selector.label')"
55
:class="'locale-chooser-field'"
@@ -40,51 +40,48 @@ export default {
4040
</script>
4141

4242
<style>
43-
.locale-chooser {
44-
height: 132px;
45-
}
46-
.locale-chooser-field {
47-
width: 100%;
48-
display: grid;
49-
grid-template-columns: 1fr 1fr;
50-
}
51-
.locale-chooser-field .label {
52-
justify-self: end;
53-
font-weight: normal;
54-
font-size: 16px;
55-
line-height: 36px;
56-
padding-right: 16px;
57-
}
58-
.locale-chooser-field .control,
59-
.locale-chooser-field .select,
60-
.locale-chooser-field select {
61-
width: 100%;
62-
}
63-
.locale-chooser-field .control .select select {
64-
padding-left: 2.5em;
65-
z-index: -1;
66-
}
67-
.locale-chooser-field .control .select::before {
68-
content: url("../assets/language.png");
69-
position: absolute;
70-
left:10px;
71-
top:8px;
72-
}
73-
.locale-chooser .select:not(.is-multiple):not(.is-loading)::after {
74-
z-index: 0;
75-
}
76-
@media only screen and (max-width: 768px) {
77-
.locale-chooser {
78-
height: auto;
79-
margin-bottom: 1rem;
80-
}
8143
.locale-chooser-field {
82-
width: 100%;
8344
display: grid;
84-
grid-template-columns: 100%;
45+
grid-template-columns: 1fr;
8546
}
8647
.locale-chooser-field .label {
87-
justify-self: auto;
48+
padding-right: 1rem;
49+
}
50+
.locale-chooser-field .control .select::before {
51+
content: url("../assets/language.png");
52+
position: absolute;
53+
left: 10px;
54+
top: 8px;
55+
z-index: 1;
56+
}
57+
.locale-chooser-field .control,
58+
.locale-chooser-field .select,
59+
.locale-chooser-field select {
60+
width: 100%;
61+
}
62+
.locale-chooser-field .control .select select {
63+
padding-left: 2.5em;
64+
}
65+
.locale-chooser-field label.label {
66+
font-weight: normal;
67+
font-size: 1rem;
68+
line-height: 2.25rem;
69+
margin-bottom: 0;
70+
}
71+
@media only screen and (min-width:769px) {
72+
.locale-chooser {
73+
justify-self: end;
74+
}
75+
}
76+
@media only screen and (min-width:1024px) {
77+
.locale-chooser-field {
78+
padding-top:0.5rem;
79+
display: grid;
80+
grid-template-columns: 1fr minmax(210px, 1fr);
81+
}
82+
.locale-chooser-field .label {
83+
padding-right: 0.5rem;
84+
justify-self: end;
85+
}
8886
}
89-
}
9087
</style>

0 commit comments

Comments
 (0)