Skip to content

Commit 56062bf

Browse files
committed
Fix responsive bigs + clean
1 parent df3c5ee commit 56062bf

File tree

4 files changed

+63
-77
lines changed

4 files changed

+63
-77
lines changed

ux.symfony.com/assets/controllers/ux-header-controller.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,22 @@ import { Controller } from '@hotwired/stimulus';
33
export default class extends Controller {
44
static targets = ['menuButton'];
55

6-
connect() {
6+
initialize() {
77
this.open = false;
88
}
99

10+
connect() {
11+
document.body.classList.remove('locked');
12+
}
13+
14+
disconnect() {
15+
document.body.classList.remove('locked');
16+
}
17+
18+
menuButtonDisconnected() {
19+
document.body.classList.remove('locked');
20+
}
21+
1022
toggleMenu() {
1123
this.open = !this.open;
1224
this.element.classList.toggle('open', this.open);

ux.symfony.com/assets/styles/sections/_header.scss

Lines changed: 18 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,58 @@
1+
:root {
2+
--header-breakpoint: 860px;
3+
}
4+
15
.AppHeader {
6+
--color-background-rgb: 255 255 255;
7+
--text-color: var(--bs-body-color);
8+
29
position: absolute;
310
inset: 0 0 auto;
411
z-index: 2;
5-
612
padding: 1.5rem 0;
13+
color: var(--text-color);
714

8-
@media (min-width: 576px) {
15+
@media (min-width: 860px) {
916
padding-top: 2rem;
1017
}
11-
//@media (min-width: 768px) {
12-
// padding-top: 3rem;
13-
//}
14-
15-
--color-background-rgb: 255 255 255;
16-
--text-color: var(--bs-body-color);
17-
18-
color: var(--text-color);
1918
}
20-
.AppHeader--white {
21-
--text-color: #fff;
22-
}
23-
2419
[data-bs-theme="dark"] {
2520
.AppHeader {
2621
--color-background-rgb: 0 0 0;
2722
}
28-
//.AppHeader--white {
29-
// --text-color: #fff;
30-
//}
3123
}
32-
33-
34-
body.locked {
35-
overflow-y: hidden;
24+
.AppHeader--white {
25+
--text-color: #fff;
3626
}
3727

38-
3928
.AppHeader::before {
4029
position: fixed;
4130
inset: 0;
4231
content: " ";
4332
backdrop-filter: blur(5px);
4433
background: rgb(var(--color-background-rgb) / 0.85);
45-
46-
// #0a0b0dde
47-
4834
opacity: 0;
4935
transform: scaleX(0);
5036
}
51-
@keyframes fade {
37+
@keyframes header-fade {
5238
from {
5339
opacity: 0;
5440
}
5541
to {
5642
opacity: 1;
5743
}
5844
}
45+
46+
body.locked {
47+
overflow-y: hidden;
48+
}
5949
.AppHeader.open {
6050
background: var(--bs-body-bg-rgb);
6151
}
6252
.AppHeader.open::before {
6353
transform: scaleX(1);
6454
inset: 0;
65-
animation: fade 200ms;
55+
animation: header-fade 200ms;
6656
opacity: 1;
6757
}
6858

@@ -74,9 +64,7 @@ body.locked {
7464
background-size: 100%;
7565
display: block;
7666
transition: filter 250ms ease-in;
77-
7867
flex-shrink: 0;
79-
8068
span {
8169
display: none;
8270
}
@@ -100,7 +88,7 @@ body.locked {
10088
font-size: 1.5rem !important;
10189
}
10290

103-
@media (min-width: 576px) {
91+
@media (min-width: 860px) {
10492
.AppHeader_toggler {
10593
display: none !important;
10694
}

ux.symfony.com/assets/styles/sections/_nav.scss

Lines changed: 19 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -6,68 +6,53 @@
66
gap: 1.5rem;
77
justify-content: space-between;
88

9-
@media (max-width: 575px) {
9+
@media (max-width: 859px) {
1010
flex-wrap: wrap;
11-
gap: 1rem;
1211
}
1312
}
1413

15-
1614
.AppNav_actions {
1715
flex-shrink: 0;
1816
flex-wrap: nowrap;
1917
display: flex;
2018
flex-direction: row-reverse;
21-
gap: 1rem;
19+
gap: 1.5rem;
2220
align-items: center;
2321

24-
@media (min-width: 575px) {
22+
@media (min-width: 860px) {
2523
order: 2;
2624
}
2725
}
2826

29-
30-
@media (max-width: 800px) {
31-
.AppHeader .AppNav_menu {
32-
transform: translateY(-20%);
33-
opacity: 0;
34-
transition: transform 250ms ease-out;
35-
z-index: -1;
36-
}
37-
.AppHeader.open .AppNav_menu {
38-
transform: translateY(0);
39-
opacity: 1;
40-
z-index: 1;
41-
}
42-
}
43-
44-
4527
.AppNav_menu {
46-
47-
gap: 2rem;
4828
justify-content: flex-end;
49-
//line-height: 2rem;
50-
align-items: center;
5129
display: flex;
5230
flex-direction: row;
31+
gap: 1.5rem;
5332

54-
@media (min-width: 800px) {
33+
@media (min-width: 860px) {
5534
margin-inline-start: auto;
5635
align-items: center;
36+
gap: 2rem;
5737
}
38+
}
5839

59-
@media (max-width: 800px) {
60-
40+
@media (max-width: 859px) {
41+
.AppNav_menu {
42+
transform: translateY(-20%);
43+
opacity: 0;
44+
z-index: -1;
45+
transition: transform 250ms ease-out;
6146
width: 100%;
6247
flex-direction: column;
63-
align-items: normal;
64-
6548
padding: 1rem;
6649
gap: 1rem;
6750
}
68-
}
69-
70-
@media (max-width: 800px) {
51+
.AppHeader.open .AppNav_menu {
52+
transform: translateY(0);
53+
opacity: 1;
54+
z-index: 1;
55+
}
7156
.AppNav_menu a {
7257
font-size: 1.5rem;
7358
padding: .5rem;
@@ -76,7 +61,6 @@
7661
}
7762

7863
.AppNav_item {
79-
8064
color: inherit;
8165
font-family: var(--font-family-title);
8266
font-size: 1rem;
@@ -101,13 +85,7 @@
10185
display: grid;
10286
place-content: center;
10387

104-
> .Icon {
88+
.Icon {
10589
font-size: 1.25rem;
10690
}
10791
}
108-
109-
.nav-component-img {
110-
height: 22px;
111-
width: 22px;
112-
border-radius: 4px;
113-
}

ux.symfony.com/templates/_header.html.twig

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,26 @@
33

44
<nav class="AppNav AppNav--white">
55

6-
<a class="AppHeader_logo" href="{{ path('app_homepage') }}" aria-label="Homepage">
6+
<a class="AppHeader_logo" href="{{ path('app_homepage') }}" aria-label="Homepage">
77
<span aria-hidden="false">Symfony UX</span>
88
</a>
99

1010
<div class="AppNav_actions">
11-
<button class="AppHeader_toggler AppNav_item AppNav_item--icon" type="button" data-action="ux-header#toggleMenu">
11+
<button
12+
class="AppHeader_toggler AppNav_item AppNav_item--icon"
13+
aria-label="Toggle Menu"
14+
data-action="ux-header#toggleMenu"
15+
>
1216
<twig:Icon name="menu"/>
13-
<span aria-hidden="false">Menu</span>
1417
</button>
1518

16-
<twig:ThemeSwitcher class="AppNav_item AppNav_item--icon" aria-label="Switch dark/light mode" />
17-
<a class="AppNav_item AppNav_item--icon" href="https://github.com/symfony/ux" aria-label="Symfony UX on GitHub">
19+
<twig:ThemeSwitcher class="AppNav_item AppNav_item--icon" aria-label="Switch dark/light mode"/>
20+
21+
<a
22+
class="AppNav_item AppNav_item--icon"
23+
aria-label="Symfony UX on GitHub"
24+
href="https://github.com/symfony/ux"
25+
>
1826
<twig:Icon name="github"/>
1927
</a>
2028
</div>

0 commit comments

Comments
 (0)