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

[Emotion] Convert EuiHeader and EuiHeaderLogo #6878

Merged
merged 15 commits into from
Jul 3, 2023
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
2 changes: 1 addition & 1 deletion src-docs/src/components/guide_page/_guide_page.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
.euiBody--headerIsFixed--double {
@include euiHeaderAffordForFixed($euiHeaderHeightCompensation * 2);

.euiHeader:not(.euiHeader--fixed) {
.euiHeader:not([data-fixed-header]) {
// Force headers below the fullscreen.
// This shouldn't be necessary in consuming applications because headers should always be at the top of the page
z-index: 0;
Expand Down
10 changes: 3 additions & 7 deletions src-docs/src/views/header/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,14 +171,10 @@ const HeaderUserMenu = () => {
isOpen={isOpen}
anchorPosition="downRight"
closePopover={closeMenu}
panelPaddingSize="none"
panelPaddingSize="m"
>
<div style={{ width: 320 }}>
<EuiFlexGroup
gutterSize="m"
className="euiHeaderProfile"
responsive={false}
>
<div style={{ width: 300 }}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was the change from width: 320 to width: 300 intentional? I see it in header/header_alert.tsx as well but just wanted to be sure.

Copy link
Contributor Author

@cee-chen cee-chen Jul 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this was intentional and was caused by the removed .euiHeaderProfile className below. That class was setting some padding, but could have been replaced by panelPaddingSize without requiring custom CSS. Doing so means there's extra width now however, so I reduced it slightly to a nice round number.

The width honestly doesn't really matter and is just an implementation detail/example - it also only affects this specific example and not consumer usage.

<EuiFlexGroup gutterSize="m" responsive={false}>
<EuiFlexItem grow={false}>
<EuiAvatar name="John Username" size="xl" />
</EuiFlexItem>
Expand Down
10 changes: 3 additions & 7 deletions src-docs/src/views/header/header_alert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -278,14 +278,10 @@ const HeaderUserMenu = () => {
isOpen={isOpen}
anchorPosition="downRight"
closePopover={closeMenu}
panelPaddingSize="none"
panelPaddingSize="m"
>
<div style={{ width: 320 }}>
<EuiFlexGroup
gutterSize="m"
className="euiHeaderProfile"
responsive={false}
>
<div style={{ width: 300 }}>
<EuiFlexGroup gutterSize="m" responsive={false}>
<EuiFlexItem grow={false}>
<EuiAvatar name="John Username" size="xl" />
</EuiFlexItem>
Expand Down
2 changes: 1 addition & 1 deletion src/components/flyout/__snapshots__/flyout.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1093,7 +1093,7 @@ exports[`EuiFlyout renders extra screen reader instructions when fixed EuiHeader
>
<div>
<div
class="euiHeader euiHeader--default euiHeader--fixed"
class="euiHeader emotion-euiHeader-fixed-default"
data-fixed-header="true"
/>
<div>
Expand Down
17 changes: 9 additions & 8 deletions src/components/header/__snapshots__/header.test.tsx.snap
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`EuiHeader is rendered 1`] = `
exports[`EuiHeader renders 1`] = `
<div
aria-label="aria-label"
class="euiHeader euiHeader--default euiHeader--static testClass1 testClass2 emotion-euiTestCss"
class="euiHeader testClass1 testClass2 emotion-euiHeader-static-default-euiTestCss"
data-test-subj="test subject string"
/>
`;

exports[`EuiHeader renders children 1`] = `
<div
class="euiHeader euiHeader--default euiHeader--static"
class="euiHeader emotion-euiHeader-static-default"
>
<span>
Hello!
Expand All @@ -20,13 +20,13 @@ exports[`EuiHeader renders children 1`] = `

exports[`EuiHeader renders dark theme 1`] = `
<div
class="euiHeader euiHeader--dark euiHeader--static"
class="euiHeader emotion-euiHeader-static-dark"
/>
`;

exports[`EuiHeader renders in fixed position 1`] = `
<div
class="euiHeader euiHeader--default euiHeader--fixed"
class="euiHeader emotion-euiHeader-fixed-default"
data-fixed-header="true"
>
<span>
Expand All @@ -37,7 +37,7 @@ exports[`EuiHeader renders in fixed position 1`] = `

exports[`EuiHeader sections render breadcrumbs and props 1`] = `
<div
class="euiHeader euiHeader--default euiHeader--static"
class="euiHeader emotion-euiHeader-static-default"
>
<nav
aria-label="Breadcrumbs"
Expand All @@ -53,6 +53,7 @@ exports[`EuiHeader sections render breadcrumbs and props 1`] = `
<span
aria-current="page"
class="euiBreadcrumb__content emotion-euiBreadcrumb__content-application-isTruncatedLast-onlyChild-euiTextColor-default"
title="Breadcrumb"
>
Breadcrumb
</span>
Expand All @@ -64,7 +65,7 @@ exports[`EuiHeader sections render breadcrumbs and props 1`] = `

exports[`EuiHeader sections render simple items and borders 1`] = `
<div
class="euiHeader euiHeader--default euiHeader--static"
class="euiHeader emotion-euiHeader-static-default"
>
<div
class="euiHeaderSection euiHeaderSection--dontGrow euiHeaderSection--left"
Expand Down Expand Up @@ -99,7 +100,7 @@ exports[`EuiHeader sections render simple items and borders 1`] = `

exports[`EuiHeader throws a warning if both children and sections were passed 1`] = `
<div
class="euiHeader euiHeader--default euiHeader--static"
class="euiHeader emotion-euiHeader-static-default"
>
<div
class="euiHeaderSection euiHeaderSection--dontGrow euiHeaderSection--left"
Expand Down
29 changes: 0 additions & 29 deletions src/components/header/_header.scss

This file was deleted.

40 changes: 0 additions & 40 deletions src/components/header/_header_logo.scss

This file was deleted.

3 changes: 0 additions & 3 deletions src/components/header/_header_profile.scss

This file was deleted.

6 changes: 0 additions & 6 deletions src/components/header/_index.scss
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
// Components
@import 'mixins';

@import 'header';
@import 'header_profile';
@import 'header_links/index';
@import 'header_logo';
@import 'header_alert/index';
@import 'header_section/index';
36 changes: 0 additions & 36 deletions src/components/header/_mixins.scss

This file was deleted.

26 changes: 26 additions & 0 deletions src/components/header/header.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import type { Meta, StoryObj } from '@storybook/react';

import { EuiHeader, EuiHeaderProps } from './header';

const meta: Meta<EuiHeaderProps> = {
title: 'EuiHeader',
component: EuiHeader,
};

export default meta;
type Story = StoryObj<EuiHeaderProps>;

export const Playground: Story = {
args: {
position: 'static',
theme: 'default',
},
};
Loading