From fc6f0d98e00ff44ba795aae827d671ba4a4ba8c5 Mon Sep 17 00:00:00 2001 From: Charles de Dreuille Date: Sun, 26 Apr 2026 15:29:36 +0100 Subject: [PATCH] Remove display contents from sticky Header Signed-off-by: Charles de Dreuille --- .../src/components/Header/Header.module.css | 20 +- packages/ui/src/components/Header/Header.tsx | 241 ++++++++++-------- 2 files changed, 137 insertions(+), 124 deletions(-) diff --git a/packages/ui/src/components/Header/Header.module.css b/packages/ui/src/components/Header/Header.module.css index 0d6e9f7612..d8d0119771 100644 --- a/packages/ui/src/components/Header/Header.module.css +++ b/packages/ui/src/components/Header/Header.module.css @@ -25,20 +25,16 @@ padding-inline: var(--bui-space-5); } - .bui-Header[data-sticky] { - display: contents; - } - .bui-HeaderAfterSticky { display: flex; flex-direction: column; gap: var(--bui-space-3); } - .bui-Header[data-sticky] .bui-HeaderBeforeSticky, - .bui-Header[data-sticky] .bui-HeaderStickySentinel, - .bui-Header[data-sticky] .bui-HeaderContent, - .bui-Header[data-sticky] .bui-HeaderAfterSticky { + .bui-HeaderBeforeSticky[data-sticky], + .bui-HeaderStickySentinel[data-sticky], + .bui-HeaderContent[data-sticky], + .bui-HeaderAfterSticky[data-sticky] { width: 100%; padding-inline: var(--bui-space-5); box-sizing: border-box; @@ -48,7 +44,7 @@ padding-top: var(--bui-space-4); } - .bui-Header[data-sticky] .bui-HeaderBeforeSticky { + .bui-HeaderBeforeSticky[data-sticky] { padding-top: var(--bui-space-6); } @@ -72,15 +68,15 @@ z-index: 10; background-color: var(--bui-bg-app); - .bui-Header[data-on-bg='neutral-1'] & { + &[data-on-bg='neutral-1'] { background-color: var(--bui-bg-neutral-1); } - .bui-Header[data-on-bg='neutral-2'] & { + &[data-on-bg='neutral-2'] { background-color: var(--bui-bg-neutral-2); } - .bui-Header[data-on-bg='neutral-3'] & { + &[data-on-bg='neutral-3'] { background-color: var(--bui-bg-neutral-3); } } diff --git a/packages/ui/src/components/Header/Header.tsx b/packages/ui/src/components/Header/Header.tsx index 6e36d627f8..ab64dd6e7d 100644 --- a/packages/ui/src/components/Header/Header.tsx +++ b/packages/ui/src/components/Header/Header.tsx @@ -79,7 +79,9 @@ function renderInlineMarkdown(text: string): React.ReactNode[] { * @public */ export const Header = (props: HeaderProps) => { - const { ownProps, dataAttributes } = useDefinition(HeaderDefinition, props); + const { ownProps, dataAttributes } = useDefinition(HeaderDefinition, props, { + classNameTarget: props.sticky ? 'content' : 'root', + }); const { classes, title, @@ -147,63 +149,70 @@ export const Header = (props: HeaderProps) => { }; }, [sticky]); - return ( -
- {tags && tags.length > 0 && ( -
-
    - {tags.map((tag, i) => ( -
  • 0 && ( +
    +
      + {tags.map((tag, i) => ( +
    • + {tag.href ? ( + - {tag.href ? ( - - {tag.label} - - ) : ( - - {tag.label} - - )} -
    • + {tag.label} + + ) : ( + + {tag.label} + + )} + + ))} +
    +
    + ); + + const titleAndActionsContent = ( + <> +
    +
    + {breadcrumbs && + breadcrumbs.map(breadcrumb => ( + + + {breadcrumb.label} + + + ))} -
+

{title}

- )} - {sticky && ( -