Skip to content

Commit b82b192

Browse files
authored
Merge pull request #309 from BeAPI/fix/header
fix (header) : handle admin-bar scroll attachment on mobile
2 parents 4c1ec82 + e555784 commit b82b192

File tree

4 files changed

+27
-16
lines changed

4 files changed

+27
-16
lines changed

.stylelintrc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,14 @@
3232
"custom-property-pattern": null,
3333
"indentation": 4,
3434
"number-leading-zero": "never",
35-
"string-quotes": "double"
35+
"string-quotes": "double",
36+
"length-zero-no-unit": [
37+
true,
38+
{
39+
"ignore": ["custom-properties"],
40+
"ignoreFunctions": ["var", "/^--/"]
41+
}
42+
]
3643
}
3744
}
3845
]

src/scss/01-abstract/_variables.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,9 @@ $external-gutter: 25px;
102102
// ----
103103
$breakpoints: (
104104
xs: 480,
105-
s: 600,
105+
s: 601, // 601px is a wordpress breakpoint (admin-bar become sticky)
106106
sm: 768,
107-
admin-bar: 784,
107+
admin-bar: 784, // admin bar height change
108108
md: 1024,
109109
mdl: 1200,
110110
lg: $container-wide + $external-gutter,

src/scss/03-base/_variables-css.scss

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,11 @@
4141
/*
4242
* Admin bar
4343
*/
44-
--wp-admin-bar-height: 46px;
44+
--wp-admin-bar-height: 0rem;
45+
46+
.admin-bar {
47+
--wp-admin-bar-height: 46px;
48+
}
4549

4650
/*
4751
* Alignments breakpoints
@@ -70,7 +74,9 @@
7074
/*
7175
* Admin bar
7276
*/
73-
--wp-admin-bar-height: 32px;
77+
.admin-bar {
78+
--wp-admin-bar-height: 32px;
79+
}
7480
}
7581

7682
@include breakpoints(md) {

src/scss/08-template-parts/_header.scss

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
&__inner {
1111
position: fixed;
12-
top: 0;
12+
top: var(--wp-admin-bar-height);
1313
z-index: 10000;
1414
width: 100%;
1515
background: var(--wp--preset--color--cyan-bluish-gray);
@@ -163,16 +163,6 @@
163163
}
164164
}
165165

166-
.admin-bar &__inner {
167-
top: var(--wp-admin-bar-height);
168-
}
169-
170-
.scroll-up &__inner,
171-
.scroll-down &__inner,
172-
.scroll-bottom &__inner {
173-
top: 0;
174-
}
175-
176166
@include breakpoints(lg, max) {
177167
&__menu {
178168
position: absolute;
@@ -210,6 +200,14 @@
210200
}
211201
}
212202

203+
@include breakpoints(s, max) {
204+
.scroll-up &__inner,
205+
.scroll-down &__inner,
206+
.scroll-bottom &__inner {
207+
top: 0;
208+
}
209+
}
210+
213211
@include breakpoints(sm) {
214212
&__menu {
215213
#{$el}__logo-link {

0 commit comments

Comments
 (0)