diff --git a/changelogs/fragments/8600.yml b/changelogs/fragments/8600.yml new file mode 100644 index 000000000000..d1e8a5c00480 --- /dev/null +++ b/changelogs/fragments/8600.yml @@ -0,0 +1,2 @@ +fix: +- Fix padding and responsive behavior of page header ([#8600](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8600)) \ No newline at end of file diff --git a/src/core/public/chrome/ui/header/__snapshots__/header.test.tsx.snap b/src/core/public/chrome/ui/header/__snapshots__/header.test.tsx.snap index 8cdd0a0f20aa..da288014a02c 100644 --- a/src/core/public/chrome/ui/header/__snapshots__/header.test.tsx.snap +++ b/src/core/public/chrome/ui/header/__snapshots__/header.test.tsx.snap @@ -20461,27 +20461,41 @@ exports[`Header renders page header with application title 1`] = ` >
- +

testTitle

diff --git a/src/core/public/chrome/ui/header/header.scss b/src/core/public/chrome/ui/header/header.scss index ed4608a605c5..f1d4e3eda91c 100644 --- a/src/core/public/chrome/ui/header/header.scss +++ b/src/core/public/chrome/ui/header/header.scss @@ -70,7 +70,7 @@ } .newTopNavHeaderTitle { - line-height: 1; + line-height: $euiButtonHeightSmall; // match button size so title is centered font-size: 2rem; } @@ -116,5 +116,36 @@ .secondaryPageHeaderFlexGroup { display: flex; flex-direction: column; + + // Override eui responsive spacing for header elements + // stylelint-disable-next-line @osd/stylelint/no_modifying_global_selectors + .euiHeaderSection--left, + .euiHeaderSection--right { + // stylelint-disable-next-line @osd/stylelint/no_modifying_global_selectors + .euiFlexGroup--responsive > .euiFlexItem { + margin: $euiSizeXS 0 !important; // set as !important in eui + } + } + } + + // Add bottom margin to left group to counter-act negative margins from gutters + .leftSecondaryPageHeaderFlexGroup { + margin-bottom: $euiSizeXS; + } +} + +// Make sure there's space betweeen left and right header content on non-mobile screens +@include euiBreakpoint("m", "l", "xl", "xxl", "xxxl") { + .leftSecondaryPageHeaderFlexGroup { + margin-right: $euiSizeM; + } +} + +// Make badges/health statuses line-height match buttons so its vertically centered +.leftSecondaryPageHeaderFlexGroup { + // stylelint-disable-next-line @osd/stylelint/no_modifying_global_selectors + .euiBadge, + .euiHealth { + line-height: $euiButtonHeightSmall !important; } } diff --git a/src/core/public/chrome/ui/header/header.tsx b/src/core/public/chrome/ui/header/header.tsx index ba2dd4282e84..dea3c8e3840d 100644 --- a/src/core/public/chrome/ui/header/header.tsx +++ b/src/core/public/chrome/ui/header/header.tsx @@ -560,23 +560,27 @@ export function Header({ {/* Left Section */} - - - + + + - {breadcrumbs &&

{breadcrumbs[breadcrumbs.length - 1]?.text}

} + {breadcrumbs && ( +

+ {breadcrumbs[breadcrumbs.length - 1]?.text} +

+ )}
- {badge && {badge}} + {badge && {badge}} - {leftControls && {leftControls}} + {leftControls && {leftControls}}