Skip to content

Commit 5226bf0

Browse files
authored
Merge pull request #241 from OpenSourceOrg/fix/header-keep-height-develop
Keep the header at full height, and make its white background span the page
2 parents ff835ee + 68bb1b1 commit 5226bf0

8 files changed

Lines changed: 42 additions & 57 deletions

File tree

‎themes/osi/assets/css/editor-style.css‎

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<?php return array('dependencies' => array(), 'version' => 'e269384336004e90c6c8');
1+
<?php return array('dependencies' => array(), 'version' => '6cdacd840462a5c6d505');

‎themes/osi/assets/js/build/theme.js‎

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

‎themes/osi/assets/js/src/theme/header-resize.js‎

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,17 @@ License: GPLv2
2020

2121
const header = document.querySelector( '.header-main' );
2222

23-
// The header is sticky but still in flow, so shrinking it lifts the page by 25px
24-
// ($headerInnerHeight 125px down to the 100px cap) and scroll anchoring corrects scrollY
25-
// to match. One threshold would be re-crossed by that correction and the class would
26-
// toggle in a loop, so the bound to beat depends on which state we are in. Growing back
27-
// only at 0 is the safe end: browsers suppress anchoring while the scroller sits at 0.
28-
const SHRINK_AT = 40;
29-
const GROW_AT = 0;
23+
const SHRINK_AT = 40; // px scrolled before the logo shrinks
3024

3125
if ( header ) {
3226
let ticking = false;
3327

3428
const update = () => {
3529
ticking = false;
36-
const isSmall = header.classList.contains( 'header-main-small' );
37-
const next = window.scrollY > ( isSmall ? GROW_AT : SHRINK_AT );
30+
const small = window.scrollY > SHRINK_AT;
3831

39-
if ( next !== isSmall ) {
40-
header.classList.toggle( 'header-main-small', next );
32+
if ( small !== header.classList.contains( 'header-main-small' ) ) {
33+
header.classList.toggle( 'header-main-small', small );
4134
}
4235
};
4336

‎themes/osi/assets/scss/_6_components.header.scss‎

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,11 @@
2222
.header--inner {
2323
position: static;
2424
opacity: 1;
25-
transition: padding .3s, max-height .3s;
2625
z-index: 999;
2726
height: $headerInnerHeight;
28-
max-height: $headerInnerHeight;
2927
display: flex;
3028
align-items: center;
31-
@media only screen and ( max-width: 1200px) {
29+
@media only screen and (max-width: #{$break-nav - 0.06}) {
3230
background: #fff;
3331
padding: 16px;
3432
}
@@ -76,9 +74,6 @@
7674
}
7775
&.header-main-small {
7876
.header--inner {
79-
padding-top: 16px;
80-
padding-bottom: 16px;
81-
max-height: 100px;
8277
.header--blog-name {
8378
a {
8479
img {
@@ -115,31 +110,17 @@
115110
overflow: hidden;
116111
transition: all .3s;
117112
}
118-
.header--inner {
119-
// opacity: 0;
120-
overflow: hidden;
121-
}
122-
.header--blog-name {}
123113
.header--extra-text {
124114
display: none;
125115
}
126116
}
127117

128-
@media only screen and (max-width: #{$break-nav}) {
129-
.header-main-small {
130-
.header--blog-name img {
131-
max-height: 67.19px;
132-
}
133-
}
134-
}
135-
136118
@media only screen and (min-width: #{$break-nav}) {
137119
.header--inner,
138120
.header--quicklinks-inner {
139121
// @include clearfix();
140122
padding-left: $maxPadding;
141123
padding-right: $maxPadding;
142-
padding-top: 1em;
143124
}
144125
.header--inner {
145126
border: 0;
@@ -159,17 +140,24 @@
159140
clear: right;
160141
padding: 0;
161142
}
162-
// open-panel layers: full-bleed white veil (::after escapes the wrapper inset) and
163-
// page dim; z-index -1 keeps both under content, tree order paints veil over dim
164-
@mixin nav-open-layers {
143+
// full-bleed white: ::after escapes the wrapper inset so the background spans the
144+
// page, which the design asks for whenever the header is white
145+
@mixin header-white-veil( $border: false ) {
165146
&::after {
166147
background-color: $Nwhite;
167-
border-bottom: 1px solid $Nlight;
148+
@if $border {
149+
border-bottom: 1px solid $Nlight;
150+
}
168151
content: '';
169152
inset: 0 (-$wrapperPad);
170153
position: absolute;
171154
z-index: -1;
172155
}
156+
}
157+
// open-panel layers: the white veil plus a page dim; z-index -1 keeps both under
158+
// content, tree order paints veil over dim
159+
@mixin nav-open-layers {
160+
@include header-white-veil( true );
173161
&::before {
174162
background: rgba(0, 0, 0, .35);
175163
content: '';
@@ -187,8 +175,10 @@
187175
.header-main:has(.menu-item.megamenu:hover:not(.is-dismissed)) {
188176
@include nav-open-layers;
189177
}
178+
// one class on purpose: raising this above .header-main.is-nav-open would win the
179+
// source-order tie and drop the open panel's bottom border
190180
.header-main-small {
191-
background-color: $Nwhite;
181+
@include header-white-veil;
192182
.nav-main {
193183
height: auto;
194184
top: 0;

‎themes/osi/assets/scss/_8_overrides.templates.scss‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,12 @@ footer.ai-footer {
528528
}
529529
.ai-header {
530530
border-top: 10px solid #3Ea638;
531+
// the veil starts inside the trim, so pull it over and repeat the trim on it,
532+
// otherwise the green stops short of the full-bleed white behind it
533+
&::after {
534+
border-top: 10px solid #3Ea638;
535+
top: -10px;
536+
}
531537
.site-branding {
532538
img {
533539
width: 200px;

‎themes/osi/style.css‎

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

‎themes/osi/style.css.map‎

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

0 commit comments

Comments
 (0)