Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EuiHeader] Fix dark theme overrides for EuiSelectableTemplateSitewide #7977

Merged
merged 3 commits into from
Aug 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions packages/eui/changelogs/upcoming/7977.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
**Bug fixes**

- Fixed `EuiSelectableTemplateSitewide` styles when used within a dark-themed `EuiHeader`
70 changes: 70 additions & 0 deletions packages/eui/src/components/header/header.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@

import React, { useState } from 'react';
import type { Meta, StoryObj } from '@storybook/react';
import { LOKI_SELECTORS } from '../../../.storybook/loki';

import {
EuiHeaderLogo,
EuiHeaderSectionItemButton,
EuiHeaderLinks,
EuiHeaderLink,
EuiSelectableTemplateSitewide,
EuiIcon,
EuiAvatar,
EuiButton,
Expand Down Expand Up @@ -84,6 +86,74 @@ export const Sections: Story = {
},
};

export const DarkThemeWithSitewideSearch: Story = {
parameters: {
layout: 'fullscreen',
controls: { include: ['theme'] },
loki: { chromeSelector: LOKI_SELECTORS.body }, // Required to capture the open popover
},
args: {
theme: 'dark',
position: 'fixed',
sections: [
{
items: [
<EuiHeaderLogo iconType="logoElastic" href="">
Elastic
</EuiHeaderLogo>,
],
},
{
items: [
<EuiSelectableTemplateSitewide
options={[
{
label: 'Welcome dashboards',
icon: {
type: 'clock',
color: 'subdued',
},
avatar: { name: 'Default Space' },
meta: [
{
text: 'Dashboard',
type: 'application',
highlightSearchString: true,
},
],
},
]}
searchProps={{
append: '⌘K',
compressed: true,
}}
popoverButton={
<EuiHeaderSectionItemButton aria-label="Sitewide search">
<EuiIcon type="search" size="m" />
</EuiHeaderSectionItemButton>
}
popoverButtonBreakpoints={['xs', 's']}
popoverProps={{
isOpen: true,
repositionOnScroll: true, // Necessary when placing search in a fixed component
}}
/>,
],
},
{
items: [
<EuiHeaderSectionItemButton
notification={true}
aria-label="Notifications: Updates available"
>
<EuiIcon type="cheer" size="m" />
</EuiHeaderSectionItemButton>,
],
},
],
},
};

const MultipleFixedHeadersExample = () => {
const [fixedHeadersCount, setFixedHeadersCount] = useState(3); // eslint-disable-line react-hooks/rules-of-hooks
const [isFlyoutOpen, setIsFlyoutOpen] = useState(false); // eslint-disable-line react-hooks/rules-of-hooks
Expand Down
12 changes: 7 additions & 5 deletions packages/eui/src/components/header/header.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,8 @@ const euiHeaderDarkStyles = (
.euiSelectableTemplateSitewide .euiFormControlLayout {
background-color: transparent;

&--group,
input {
box-shadow: inset 0 0 0 ${euiTheme.border.width.thin}
${transparentize(euiTheme.colors.ghost, 0.3)};
&--group {
border-color: ${transparentize(euiTheme.colors.ghost, 0.3)};
}

&:not(:focus-within) {
Expand All @@ -152,8 +150,12 @@ const euiHeaderDarkStyles = (
background-color: transparent;
}

.euiFormControlLayout__append {
.euiFormControlLayout__append,
.euiFormControlLayout__prepend {
background-color: transparent;
}

.euiFormLabel {
color: inherit;
}
}
Expand Down
Loading