Skip to content

Commit 4768343

Browse files
committed
feature #1417 Update the design of the language selector (javiereguiluz)
This PR was squashed before being merged into the main branch. Discussion ---------- Update the design of the language selector The current header design looks a bit crowded to me, with the links so close to each other: <img width="1172" alt="" src="https://user-images.githubusercontent.com/73419/235969569-b4fa2803-a4c6-45c7-969f-c7f1373fc401.png"> This PR changes this by making the links a bit smaller and adding more space between them: <img width="1193" alt="" src="https://user-images.githubusercontent.com/73419/235969669-dd4937fc-aa7d-4626-823d-50930c25c2f2.png"> ----- The other issue is the language selector. We're very lucky to have many translations contributed by the community. But that big number is what makes the current selector a bit hard to use (the list is very long). It also has other design issues: <img width="204" alt="" src="https://user-images.githubusercontent.com/73419/235969918-020444c4-1c07-4b13-b0b7-9e0298a66964.png"> This PR proposes a completely different design. When you click on the link to select the language, you no longer see a dropdown menu. Instead, you see a full page modal window listing all available languages. For example, if you are browsing the application in Ukrainian and click on the language selector, you'll see this: <img width="1488" alt="" src="https://user-images.githubusercontent.com/73419/235970298-2e2bb0cf-b232-4a27-83e4-44959b7aecb2.png"> The new language selector was inspired by the one used in https://europa.eu pages. In addition to displaying all languages more clearly, we now respect the features of each language, like the RTL direction of Arabic. Commits ------- b2c68c9 Update the design of the language selector
2 parents f94e895 + b2c68c9 commit 4768343

20 files changed

+151
-66
lines changed

assets/app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import './styles/app.scss';
22

3-
// loads the Bootstrap jQuery plugins
3+
// loads the Bootstrap plugins
44
import 'bootstrap/js/dist/alert';
55
import 'bootstrap/js/dist/collapse';
66
import 'bootstrap/js/dist/dropdown';

assets/styles/app.scss

Lines changed: 84 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -138,44 +138,107 @@ header {
138138
padding: 0 $navbar-toggler-padding-x;
139139
}
140140

141-
.nav-link {
142-
padding: 0 2rem;
141+
.nav-item {
142+
font-size: 18px;
143+
margin-left: 20px;
143144
}
145+
}
146+
}
147+
148+
#locale-selector-modal {
149+
background: #2c3e50;
150+
151+
.modal-dialog {
152+
@media (min-width: map-get($grid-breakpoints, 'md')) {
153+
max-width: 800px;
154+
width: 96%;
155+
}
156+
}
157+
158+
.modal-content {
159+
border: 0;
160+
}
161+
162+
.modal-header {
163+
background: #2c3e50;
164+
border-bottom: 0;
165+
color: var(--white);
166+
167+
.close { color: var(--white); opacity: 1; }
168+
}
169+
170+
.modal-body {
171+
background: #2c3e50;
144172

145173
.locales {
146-
min-width: 190px;
147-
max-height: 320px;
148-
overflow-y: scroll;
149-
150-
.dropdown-item {
151-
padding: 0.25rem 1rem;
152-
margin-bottom: 0;
153-
154-
&.active a,
155-
&.active small,
156-
&:hover a,
157-
&:hover small,
158-
a:hover {
159-
color: inherit;
174+
list-style: none;
175+
padding: 0;
176+
177+
@media (min-width: map-get($grid-breakpoints, 'md')) {
178+
display: grid;
179+
grid-template-columns: repeat(2, 1fr);
180+
grid-gap: 10px 20px;
181+
}
182+
183+
li {
184+
border-radius: 4px;
185+
margin-bottom: 10px;
186+
position: relative;
187+
188+
@media (min-width: map-get($grid-breakpoints, 'md')) {
189+
margin: 0;
190+
}
191+
192+
&.rtl a {
193+
direction: rtl;
160194
}
161195

162196
a {
197+
align-items: center;
198+
background: #fff;
199+
border-radius: 4px;
163200
color: $gray-900;
201+
display: flex;
202+
justify-content: space-between;
203+
padding: 10px 20px;
164204

165205
small {
166206
border-radius: 4px;
167207
border: 2px solid $gray-300;
168-
color: $gray-700;
169-
float: left;
170-
font-size: 12px;
208+
color: $gray-800;
209+
font-size: 14px;
210+
font-weight: bold;
171211
line-height: 1.1;
172-
margin: 2px 10px 0 0;
212+
margin-inline-start: 10px;
173213
min-width: 26px;
174-
padding: 0 3px;
214+
padding: 2px 6px;
175215
text-align: center;
176216
text-transform: uppercase;
177217
}
178218
}
219+
220+
&:hover a {
221+
outline: 3px solid #18bc9c;
222+
outline-offset: -5px;
223+
224+
small {
225+
background: #18bc9c;
226+
border-color: #18bc9c;
227+
color: #fff;
228+
}
229+
}
230+
231+
&.active a, &:hover.active a {
232+
background: #18bc9c;
233+
color: #fff;
234+
outline: none;
235+
236+
small {
237+
background: transparent;
238+
border-color: #fff;
239+
color: #fff;
240+
}
241+
}
179242
}
180243
}
181244
}

public/build/106.218afa2e.js

Lines changed: 0 additions & 2 deletions
This file was deleted.

public/build/384.abf828b0.js renamed to public/build/384.af623ff4.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/build/42.5aced7b3.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/build/106.350bc330.css renamed to public/build/42.76194c5a.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/build/630.ed629036.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/build/admin.223fd8e3.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)