From 61eeaec56b29b4d916618c399180eccac80cfe41 Mon Sep 17 00:00:00 2001 From: metart43 Date: Tue, 13 Aug 2024 16:53:58 +0100 Subject: [PATCH 01/11] backstage: run linter on `_search.scss` --- .../o-header/src/scss/features/_search.scss | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/components/o-header/src/scss/features/_search.scss b/components/o-header/src/scss/features/_search.scss index 44ae3e55f1..636cbb72b5 100644 --- a/components/o-header/src/scss/features/_search.scss +++ b/components/o-header/src/scss/features/_search.scss @@ -6,7 +6,7 @@ padding-bottom: $_o-header-padding-y; text-align: center; - &[aria-hidden="false"] { + &[aria-hidden='false'] { display: block; } } @@ -47,19 +47,25 @@ } .o-header__search-submit { - @include oButtonsContent($opts: ( - 'type': 'primary', - 'icon-only': true, - 'icon': 'search', - 'size': 'big' - )); + @include oButtonsContent( + $opts: ( + 'type': 'primary', + 'icon-only': true, + 'icon': 'search', + 'size': 'big', + ) + ); margin-left: $_o-header-padding-x; padding-left: 40px; background-position: inherit; } .o-header__search-close { - @include oIconsContent('cross', _oHeaderGet('search-close'), $size: $_o-header-icon-size-large); + @include oIconsContent( + 'cross', + _oHeaderGet('search-close'), + $size: $_o-header-icon-size-large + ); border: 0; margin-left: $_o-header-padding-x; vertical-align: middle; From 8fd4797883382edde85343eee3bb09478f4509a9 Mon Sep 17 00:00:00 2001 From: metart43 Date: Tue, 13 Aug 2024 17:00:29 +0100 Subject: [PATCH 02/11] backstage: run linter on `_variables.scss` --- components/o-header/src/scss/_variables.scss | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/o-header/src/scss/_variables.scss b/components/o-header/src/scss/_variables.scss index 8294ac9c20..a24254fc66 100644 --- a/components/o-header/src/scss/_variables.scss +++ b/components/o-header/src/scss/_variables.scss @@ -29,4 +29,5 @@ $_o-header-icon-size-large: 40; $_o-header-icon-size: 25; $_o-header-icon-size-small: 15; -$_o-header-features: 'top', 'subnav', 'search', 'nav', 'anon', 'drawer', 'megamenu', 'sticky', 'simple', 'transparent'; +$_o-header-features: 'top', 'subnav', 'search', 'nav', 'anon', 'drawer', + 'megamenu', 'sticky', 'simple', 'transparent'; From 838a3f98c90e6ab7cc70df2f4c4340dafbea80b5 Mon Sep 17 00:00:00 2001 From: metart43 Date: Tue, 13 Aug 2024 18:41:07 +0100 Subject: [PATCH 03/11] feat!: (o-header) Rework search & close buttons --- components/o-header/src/scss/_variables.scss | 2 +- .../o-header/src/scss/features/_search.scss | 29 ++++++++----------- components/o-header/src/tsx/search.tsx | 8 +++-- 3 files changed, 18 insertions(+), 21 deletions(-) diff --git a/components/o-header/src/scss/_variables.scss b/components/o-header/src/scss/_variables.scss index a24254fc66..f8f2e1b8ba 100644 --- a/components/o-header/src/scss/_variables.scss +++ b/components/o-header/src/scss/_variables.scss @@ -2,7 +2,7 @@ $o-header-is-silent: true !default; $_o-header-column-item-margin-s: 10px; $_o-header-column-item-margin-l: 20px; -$_o-header-padding-x: 14px; +$_o-header-padding-x: 12px; $_o-header-padding-y: 8px; $_o-header-buttons-theme: 'mono'; $_o-header-mega-padding-x: 24px; diff --git a/components/o-header/src/scss/features/_search.scss b/components/o-header/src/scss/features/_search.scss index 636cbb72b5..b88dbbf4fa 100644 --- a/components/o-header/src/scss/features/_search.scss +++ b/components/o-header/src/scss/features/_search.scss @@ -46,36 +46,31 @@ } } + .o-header__search-icon { + @include oIconsContent($icon-name: 'search', $size: 40, $color: white); + } + .o-header__search-submit { @include oButtonsContent( $opts: ( 'type': 'primary', - 'icon-only': true, - 'icon': 'search', 'size': 'big', ) ); + display: flex; + gap: 10px; + align-items: center; margin-left: $_o-header-padding-x; - padding-left: 40px; + padding: 0px oSpacingByName('s6') 0px oSpacingByName('s4'); background-position: inherit; } .o-header__search-close { - @include oIconsContent( - 'cross', - _oHeaderGet('search-close'), - $size: $_o-header-icon-size-large - ); + @include oTypographySans($scale: 1); + text-decoration: underline; + background: none; + padding: 0; border: 0; margin-left: $_o-header-padding-x; - vertical-align: middle; - // Match the search button's hover/focus state. - &:hover { - opacity: 0.75; - } - - @include oGridRespondTo($until: 'M') { - display: none; - } } } diff --git a/components/o-header/src/tsx/search.tsx b/components/o-header/src/tsx/search.tsx index 09f9d1f38b..78bddfd204 100644 --- a/components/o-header/src/tsx/search.tsx +++ b/components/o-header/src/tsx/search.tsx @@ -16,6 +16,7 @@ export function Search() { aria-controls="o-header-search-js" title="Close search bar"> Close search bar + Close @@ -53,9 +54,9 @@ function SearchForm(props) { {props.children} From cbc2c576c1bf436340bc1a2f4175ce55bd1405b0 Mon Sep 17 00:00:00 2001 From: metart43 Date: Wed, 14 Aug 2024 11:18:19 +0100 Subject: [PATCH 04/11] feat: (o-header) Align the search bar width and color according to the new look --- components/o-header/src/scss/_variables.scss | 1 + .../o-header/src/scss/features/_search.scss | 36 ++++++++++++------- 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/components/o-header/src/scss/_variables.scss b/components/o-header/src/scss/_variables.scss index f8f2e1b8ba..7560ca0f7c 100644 --- a/components/o-header/src/scss/_variables.scss +++ b/components/o-header/src/scss/_variables.scss @@ -8,6 +8,7 @@ $_o-header-buttons-theme: 'mono'; $_o-header-mega-padding-x: 24px; $_o-header-mega-padding-y: 18px; $_o-header-mega-z-index: 1; +$_o-header-z-index: 1; $_o-header-drawer-z-index: 100; $_o-header-drawer-width: 320px; $_o-header-drawer-divide-height: 40px; diff --git a/components/o-header/src/scss/features/_search.scss b/components/o-header/src/scss/features/_search.scss index b88dbbf4fa..3d941621a4 100644 --- a/components/o-header/src/scss/features/_search.scss +++ b/components/o-header/src/scss/features/_search.scss @@ -1,10 +1,18 @@ @mixin _oHeaderSearch() { .o-header__search { - padding-left: 0; - padding-right: 0; - padding-top: 0; + background-color: oColorsByName('white-60'); + box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.25); + position: absolute; + z-index: $_o-header-z-index; + width: 100%; padding-bottom: $_o-header-padding-y; - text-align: center; + + .o-header__container { + max-width: 840px; + display: flex; + flex-direction: column; + margin: 0 auto; + } &[aria-hidden='false'] { display: block; @@ -15,14 +23,6 @@ display: none; } - .o-header__search-form { - display: flex; - align-items: center; - margin: 0 auto; - max-width: 640px; - position: relative; - } - .o-header__search-term { @include oTypographySans($scale: -1); box-sizing: border-box; @@ -48,6 +48,10 @@ .o-header__search-icon { @include oIconsContent($icon-name: 'search', $size: 40, $color: white); + + @include oGridRespondTo($until: 'S') { + display: none; + } } .o-header__search-submit { @@ -63,6 +67,10 @@ margin-left: $_o-header-padding-x; padding: 0px oSpacingByName('s6') 0px oSpacingByName('s4'); background-position: inherit; + + @include oGridRespondTo($until: 'S') { + padding: 0px oSpacingByName('s4'); + } } .o-header__search-close { @@ -72,5 +80,9 @@ padding: 0; border: 0; margin-left: $_o-header-padding-x; + + @include oGridRespondTo($until: 'S') { + display: none; + } } } From ef7eeb2be28ab1dd38d525469979cf52b8cf0795 Mon Sep 17 00:00:00 2001 From: metart43 Date: Wed, 14 Aug 2024 11:42:08 +0100 Subject: [PATCH 05/11] fix: (o-header) Fix a11ty issues where `aria-controls` atrributes were referencing incorect IDs --- components/o-header/src/tsx/search.tsx | 12 ++++++++---- components/o-header/src/tsx/sticky.tsx | 21 ++++++++++++++------- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/components/o-header/src/tsx/search.tsx b/components/o-header/src/tsx/search.tsx index 78bddfd204..ba838048c0 100644 --- a/components/o-header/src/tsx/search.tsx +++ b/components/o-header/src/tsx/search.tsx @@ -2,9 +2,11 @@ // export function Search() { + const searchDivId = 'o-header-search'; + return (