+ EuiPageHeader comes with some pre-determined
+ content that you can apply to the left and right sides of the
+ component.
+
+
+ The left side allows you to pass any combination of{' '}
+ pageTitle, description,{' '}
+ tabs, or any leftSideContent.
+ The order of which are determined by the particular combination.
+
+
+ The right side, rightSideContent, allows for just
+ a simple array of nodes which are placed within a
+ flexbox row. This is usually in the form of multiple buttons, of
+ which, at least one is primary (or{' '}
+ {'fill="true"'}). These items are
+ also display in reverse order so that the first and
+ primary action should be first in the list.
+
+
+ You can further adjust the display of these content types with an
+ optional iconType placed to the left of the
+ title, alignItems for adjusting the vertical
+ alignment of the two sides, and responsiveOrder
+ to determine which content to display first on smaller screens.
+
+ Or you can simply pass in your own custom children{' '}
+ utilizing the EuiPageHeaderSection components. Do
+ note, that when supplying children,{' '}
+ EuiPageHeader will completely ignore any other
+ content props and only render the children.
+
- Or you can simply pass in your own custom children{' '}
- utilizing the EuiPageHeaderSection components. Do
- note, that when supplying children,{' '}
- EuiPageHeader will completely ignore any other
- content props and only render the children.
-
+ <>
+
+ The page header content props mainly are helpful props to push
+ content into established Elastic page layout patterns. They are
+ completely optional and by nature, inflexible. If you need a layout
+ that does not match these patterns you can simply pass in your own{' '}
+ children utilizing the{' '}
+ EuiPageHeaderSection components. Do note, that when
+ supplying children,{' '}
+ EuiPageHeader will completely ignore any other
+ content props and only render the children.
+
From c19d0380e8446667d0b31401a324770a3a252e89 Mon Sep 17 00:00:00 2001
From: cchaos
Date: Tue, 26 Jan 2021 18:00:12 -0500
Subject: [PATCH 05/27] Fixin amsterdam small and reverse shadows
---
.../eui-amsterdam/global_styling/mixins/_shadow.scss | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/src/themes/eui-amsterdam/global_styling/mixins/_shadow.scss b/src/themes/eui-amsterdam/global_styling/mixins/_shadow.scss
index 49d46e2e0e4c..f50c8a74c28e 100644
--- a/src/themes/eui-amsterdam/global_styling/mixins/_shadow.scss
+++ b/src/themes/eui-amsterdam/global_styling/mixins/_shadow.scss
@@ -17,8 +17,7 @@
box-shadow:
0 .7px 1.4px rgba($color, shadowOpacity(.07)),
0 1.9px 4px rgba($color, shadowOpacity(.05)),
- 0 4.5px 10px rgba($color, shadowOpacity(.05)),
- 0 15px 32px rgba($color, shadowOpacity(.04));
+ 0 4.5px 10px rgba($color, shadowOpacity(.05));
@if ($opacity > 0) {
@warn 'The $opacity variable of euiBottomShadowSmall() will be depricated in a future version of EUI.';
@@ -77,9 +76,9 @@
) {
@if ($reverse) {
box-shadow:
- 0 2.7px -9px rgba($color, shadowOpacity(.13)),
- 0 9.4px -24px rgba($color, shadowOpacity(.09)),
- 0 21.8px -43px rgba($color, shadowOpacity(.08));
+ 0 -2.7px 9px rgba($color, shadowOpacity(.13)),
+ 0 -9.4px 24px rgba($color, shadowOpacity(.09)),
+ 0 -21.8px 43px rgba($color, shadowOpacity(.08));
} @else {
box-shadow:
0 2.7px 9px rgba($color, shadowOpacity(.13)),
From eff79dc4f7b89abb6eff59920aab8bdc0cc2a298 Mon Sep 17 00:00:00 2001
From: cchaos
Date: Tue, 26 Jan 2021 18:02:09 -0500
Subject: [PATCH 06/27] =?UTF-8?q?=E2=80=98Fixing=E2=80=99=20paddingSize=20?=
=?UTF-8?q?prop=20on=20EuiPageContent?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/components/page/page_content/page_content.tsx | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/components/page/page_content/page_content.tsx b/src/components/page/page_content/page_content.tsx
index c707a6639c45..cefc78a27537 100644
--- a/src/components/page/page_content/page_content.tsx
+++ b/src/components/page/page_content/page_content.tsx
@@ -48,7 +48,8 @@ export type EuiPageContentProps = CommonProps &
export const EuiPageContent: FunctionComponent = ({
verticalPosition,
horizontalPosition,
- panelPaddingSize = 'l',
+ panelPaddingSize,
+ paddingSize = 'l',
children,
className,
...rest
@@ -63,7 +64,10 @@ export const EuiPageContent: FunctionComponent = ({
);
return (
-
+
{children}
);
From 206351c8081ceaeab860433ea3cd4ed5c4fe44e7 Mon Sep 17 00:00:00 2001
From: cchaos
Date: Thu, 28 Jan 2021 12:19:53 -0500
Subject: [PATCH 07/27] Adding custom options for `restrictWidth`
---
src-docs/src/views/page/page_example.js | 6 ++---
src/components/page/page.tsx | 2 +-
.../__snapshots__/page_header.test.tsx.snap | 2 +-
.../page/page_header/_page_header.scss | 18 +++++++------
.../page/page_header/page_header.tsx | 25 +++++++++++++++----
5 files changed, 35 insertions(+), 18 deletions(-)
diff --git a/src-docs/src/views/page/page_example.js b/src-docs/src/views/page/page_example.js
index 8ac88210dad5..75cd7dfd5297 100644
--- a/src-docs/src/views/page/page_example.js
+++ b/src-docs/src/views/page/page_example.js
@@ -158,15 +158,15 @@ export const PageExample = {
flexbox row. This is usually in the form of multiple buttons, of
which, at least one is primary (or{' '}
{'fill="true"'}). These items are
- also display in reverse order so that the first and
- primary action should be first in the list.
+ also displayed in reverse order so that the first
+ and primary action should be first in the list.
You can further adjust the display of these content types with an
optional iconType placed to the left of the
title, alignItems for adjusting the vertical
alignment of the two sides, and responsiveOrder
- to determine which content to display first on smaller screens.
+ to determine which content side to display first on smaller screens.
>
),
diff --git a/src/components/page/page.tsx b/src/components/page/page.tsx
index 87fd0cd70d9a..33deab797a86 100644
--- a/src/components/page/page.tsx
+++ b/src/components/page/page.tsx
@@ -43,7 +43,7 @@ export interface EuiPageProps
restrictWidth?: boolean | number | string;
/**
* Adjust the padding.
- * When using this setting it's best to be consistent throught all similar usages.
+ * When using this setting it's best to be consistent throughout all similar usages.
*/
paddingSize?: typeof SIZES[number];
}
diff --git a/src/components/page/page_header/__snapshots__/page_header.test.tsx.snap b/src/components/page/page_header/__snapshots__/page_header.test.tsx.snap
index c2cf2a5db1aa..3f25cab3c07e 100644
--- a/src/components/page/page_header/__snapshots__/page_header.test.tsx.snap
+++ b/src/components/page/page_header/__snapshots__/page_header.test.tsx.snap
@@ -298,7 +298,7 @@ exports[`EuiPageHeader props responsiveOrder rightFirst is rendered 1`] = `
exports[`EuiPageHeader props restrictWidth is rendered as true 1`] = `
+ When using supplying tabs with a{' '}
+ pageTitle, EuiPageHeader will
+ promote those tabs as if they are the page title. This means that
+ any description, or{' '}
+ leftSideContent will sit below{' '}
+ the tabs.
+
- When using supplying tabs with a{' '}
+ When using supplying tabs without a{' '}
pageTitle, EuiPageHeader will
promote those tabs as if they are the page title. This means that
any description, or{' '}
diff --git a/src-docs/src/views/page/page_header.js b/src-docs/src/views/page/page_header.js
index 592a3191b42e..085149d8c907 100644
--- a/src-docs/src/views/page/page_header.js
+++ b/src-docs/src/views/page/page_header.js
@@ -2,60 +2,36 @@ import React from 'react';
import {
EuiPageHeader,
+ EuiCode,
EuiText,
EuiButton,
- EuiPageHeaderContent,
} from '../../../../src/components';
export default () => (
- <>
-
-
+ This custom content (children), on the other hand, exists below the
+ content above including below the right side content and therefore will
+ stretch beneath them. Unless you set the alignItems{' '}
+ prop to something other than top.
+
+ This custom content (children), on the other hand, exists below the
+ content above including below the right side content and therefore will
+ stretch beneath them. Unless you set the alignItems{' '}
+ prop to something other than top.
+
`;
-exports[`EuiPageHeader props alignItems middle is rendered 1`] = `
+exports[`EuiPageHeader props alignItems center is rendered 1`] = `
-
- Page title
-
-
-
-
+
+ Page title
+
+
-
+
+
+
+
+
+
+
+
@@ -93,32 +109,144 @@ exports[`EuiPageHeader props alignItems top is rendered 1`] = `
class="euiPageHeader euiPageHeader--responsive euiPageHeader--top"
>
-
- Page title
-
+
+
+ Page title
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+`;
+
+exports[`EuiPageHeader props page content props are passed down is rendered 1`] = `
+
-
+
+
+ Page title
+
+
+
+
+ Description
+
+
-
+
+
+
+
+ Anything
+
+
+
+
+
+ Tab 1
+
+
+
+
+ Tab 2
+
@@ -126,327 +254,540 @@ exports[`EuiPageHeader props alignItems top is rendered 1`] = `
`;
-exports[`EuiPageHeader props children is rendered 1`] = `
+exports[`EuiPageHeader props responsive is rendered as false 1`] = `
- Child
-
+ class="euiPageHeader euiPageHeader--center"
+/>
`;
-exports[`EuiPageHeader props children is rendered even if content props are passed 1`] = `
+exports[`EuiPageHeader props responsive is rendered as reverse 1`] = `
- Child
-
+ class="euiPageHeader euiPageHeader--responsiveReverse euiPageHeader--center"
+/>
`;
-exports[`EuiPageHeader props description is rendered 1`] = `
+exports[`EuiPageHeader props restrictWidth is rendered as custom 1`] = `
+`;
+
+exports[`EuiPageHeader props restrictWidth is rendered as true 1`] = `
+
+`;
+
+exports[`EuiPageHeaderContent is rendered 1`] = `
+
-
- Description
-
-
+ class="euiFlexItem"
+ />
`;
-exports[`EuiPageHeader props leftSideContent is rendered 1`] = `
+exports[`EuiPageHeaderContent props alignItems bottom is rendered 1`] = `
-
- Anything
-
+
+
+ Page title
+
+
+
+
+
+
+
+ Button 1
+
+
+
+
+ Button 2
+
+
+
+
`;
-exports[`EuiPageHeader props pageTitle is rendered 1`] = `
+exports[`EuiPageHeaderContent props alignItems center is rendered 1`] = `
-
+
+ Page title
+
+
+
+
- Page title
-
+
+
+
+ Button 1
+
+
+
+
+ Button 2
+
+
+
+
`;
-exports[`EuiPageHeader props pageTitle is rendered with icon 1`] = `
+exports[`EuiPageHeaderContent props alignItems top is rendered 1`] = `
-
-
- Page title
-
+
+ Page title
+
+
+
+
+
+
+ Button 1
+
+
+
+
+ Button 2
+
+
+
+
`;
-exports[`EuiPageHeader props responsive is rendered as false 1`] = `
+exports[`EuiPageHeaderContent props children is rendered 1`] = `
+ Child
`;
-exports[`EuiPageHeader props responsiveOrder leftFirst is rendered 1`] = `
+exports[`EuiPageHeaderContent props children is rendered even if content props are passed 1`] = `
`;
-exports[`EuiPageHeader props rightSideContent is rendered with rightSideResponsive as true 1`] = `
+exports[`EuiPageHeaderContent props rightSideContent is rendered with rightSideResponsive as true 1`] = `
-
+
-
- Button 1
-
-
-
-
- Button 2
-
+
+
+ Button 1
+
+
+
+
+ Button 2
+
+
`;
-exports[`EuiPageHeader props tabs is rendered 1`] = `
+exports[`EuiPageHeaderContent props tabs is rendered 1`] = `
);
@@ -159,28 +69,18 @@ describe('EuiPageHeader', () => {
});
});
- describe('responsiveOrder', () => {
- RESPONSIVE_ORDER.forEach((order) => {
- it(`${order} is rendered`, () => {
- const component = render(
-
- );
-
- expect(component).toMatchSnapshot();
- });
- });
- });
-
describe('responsive', () => {
test('is rendered as false', () => {
const component = render();
expect(component).toMatchSnapshot();
});
+
+ test('is rendered as reverse', () => {
+ const component = render();
+
+ expect(component).toMatchSnapshot();
+ });
});
describe('restrictWidth', () => {
@@ -189,6 +89,12 @@ describe('EuiPageHeader', () => {
expect(component).toMatchSnapshot();
});
+
+ test('is rendered as custom', () => {
+ const component = render();
+
+ expect(component).toMatchSnapshot();
+ });
});
});
});
diff --git a/src/components/page/page_header/page_header.tsx b/src/components/page/page_header/page_header.tsx
index 1cfee059dbe0..7044187cee8f 100644
--- a/src/components/page/page_header/page_header.tsx
+++ b/src/components/page/page_header/page_header.tsx
@@ -17,85 +17,19 @@
* under the License.
*/
-import React, { FunctionComponent, ReactNode, HTMLAttributes } from 'react';
+import React, { FunctionComponent, HTMLAttributes } from 'react';
import classNames from 'classnames';
import { CommonProps } from '../../common';
-import { EuiIcon, IconType } from '../../icon';
-import { EuiTab, EuiTabs, EuiTabsProps } from '../../tabs';
-import { EuiPageHeaderSection } from './page_header_section';
-import { EuiFlexGroup, EuiFlexItem } from '../../flex';
-import { EuiSpacer } from '../../spacer';
-import { EuiTitle } from '../../title';
-import { EuiText } from '../../text';
+import {
+ EuiPageHeaderContent,
+ EuiPageHeaderContentProps,
+} from './page_header_content';
-export const ALIGN_ITEMS = ['top', 'bottom', 'middle'] as const;
-export const RESPONSIVE_ORDER = ['leftFirst', 'rightFirst'] as const;
-
-// Gets all the tab props including the button or link props
-type EuiTabProps = React.ComponentProps & {
- /**
- * Visible text of the tab
- */
- label: string;
-};
-
-export type EuiPageHeaderTitle = {
- /**
- * Wrapped in an `H1` so choose appropriately.
- * A simple string is best
- */
- pageTitle?: ReactNode;
- /**
- * Optional icon to place to the left of the title
- */
- iconType?: IconType;
-};
-
-export type EuiPageHeaderTabs = {
- /**
- * In-app navigation presented as large borderless tabs.
- * Accepts an array of `EuiTab` objects;
- * HELP: This is evaluating to `any[]` in the props table
- */
- tabs?: EuiTabProps[];
- /**
- * Any extras to apply to the outer tabs container.
- * Extends `EuiTabs`
- */
- tabsProps?: Omit;
-};
-
-/**
- * The left side can either be a title with optional description and/or icon;
- * Or a list of tabs,
- * Or a custom node
- */
-type EuiPageHeaderLeft = EuiPageHeaderTitle &
- EuiPageHeaderTabs & {
- /**
- * Pass custom content to the left side with `leftSideContent`
- */
- leftSideContent?: ReactNode;
- /**
- * Position is dependent on existing with a `pageTitle` or `tabs`
- * Automatically get wrapped in a single paragraph tag inside an EuiText block
- */
- description?: string | ReactNode;
- };
+export const ALIGN_ITEMS = ['top', 'bottom', 'center'] as const;
export type EuiPageHeaderProps = CommonProps &
HTMLAttributes &
- EuiPageHeaderLeft & {
- /**
- * Set to false if you don't want the children to stack
- * at small screen sizes.
- */
- responsive?: boolean;
- /**
- * Pass custom an array of content to this side usually up to 3 buttons.
- * The first button should be primary, usually with `fill` and will be visually displayed as the last item
- */
- rightSideContent?: ReactNode[];
+ EuiPageHeaderContentProps & {
/**
* Sets the max-width of the page,
* set to `true` to use the default size of `1000px (1200 for Amsterdam)`,
@@ -104,38 +38,26 @@ export type EuiPageHeaderProps = CommonProps &
* set to a string for a custom width in custom measurement.
*/
restrictWidth?: boolean | number | string;
- /**
- * Vertical alignment of the left and right side content;
- * Default is `top` or dependendent on content
- */
- alignItems?: typeof ALIGN_ITEMS[number];
- /**
- * Which content to display first when on smaller screens.
- * Useful when the right side content should actually come beforehand in the hierarchy (like time)
- */
- responsiveOrder?: typeof RESPONSIVE_ORDER[number];
- /**
- * Whether the array of right side items should all break to their own line on small screens
- */
- rightSideResponsive?: boolean;
};
export const EuiPageHeader: FunctionComponent = ({
+ className,
+ restrictWidth = false,
+ style,
+
+ // Page header content shared props:
+ alignItems,
+ responsive = true,
+ children,
+
+ // Page header content only props:
pageTitle,
iconType,
- description,
tabs,
tabsProps,
- className,
- leftSideContent,
+ description,
rightSideContent,
- restrictWidth = false,
- alignItems = 'center',
- responsiveOrder = 'leftFirst',
- rightSideResponsive = false,
- children,
- responsive = true,
- style,
+ rightSideResponsive,
...rest
}) => {
let widthClassname;
@@ -151,17 +73,16 @@ export const EuiPageHeader: FunctionComponent = ({
const classes = classNames(
'euiPageHeader',
{
- 'euiPageHeader--responsive': responsive,
- 'euiPageHeader--tabsAtBottom': !children && pageTitle && tabs,
- 'euiPageHeader--responsiveReverse':
- !children && responsiveOrder === 'rightFirst',
+ 'euiPageHeader--responsive': responsive === true,
+ 'euiPageHeader--responsiveReverse': responsive === 'reverse',
+ 'euiPageHeader--tabsAtBottom': pageTitle && tabs,
},
- `euiPageHeader--${alignItems}`,
+ `euiPageHeader--${alignItems ?? 'center'}`,
widthClassname,
className
);
- if (children) {
+ if (!pageTitle && !tabs && !description && !rightSideContent) {
return (
);
};
diff --git a/src/components/page/page_header/page_header_content.test.tsx b/src/components/page/page_header/page_header_content.test.tsx
index ed5351f53cf5..b8e07890796c 100644
--- a/src/components/page/page_header/page_header_content.test.tsx
+++ b/src/components/page/page_header/page_header_content.test.tsx
@@ -25,10 +25,9 @@ import {
ALIGN_ITEMS,
EuiPageHeaderContent,
EuiPageHeaderContentProps,
- RESPONSIVE_ORDER,
} from './page_header_content';
-const tabs: EuiPageHeaderContentProps['tabs'] = [
+export const tabs: EuiPageHeaderContentProps['tabs'] = [
{
label: 'Tab 1',
isSelected: true,
@@ -38,7 +37,7 @@ const tabs: EuiPageHeaderContentProps['tabs'] = [
},
];
-const rightSideContent: EuiPageHeaderContentProps['rightSideContent'] = [
+export const rightSideContent: EuiPageHeaderContentProps['rightSideContent'] = [
Button 1,
Button 2,
];
@@ -165,33 +164,17 @@ describe('EuiPageHeaderContent', () => {
});
});
- describe('responsiveOrder', () => {
- RESPONSIVE_ORDER.forEach((order) => {
- it(`${order} is rendered`, () => {
- const component = render(
-
- );
-
- expect(component).toMatchSnapshot();
- });
- });
- });
-
describe('responsive', () => {
test('is rendered as false', () => {
const component = render();
expect(component).toMatchSnapshot();
});
- });
- describe('restrictWidth', () => {
- test('is rendered as true', () => {
- const component = render();
+ test('is rendered as reverse', () => {
+ const component = render(
+
+ );
expect(component).toMatchSnapshot();
});
diff --git a/src/components/page/page_header/page_header_content.tsx b/src/components/page/page_header/page_header_content.tsx
index e80f27f02ad4..da81c4f90276 100644
--- a/src/components/page/page_header/page_header_content.tsx
+++ b/src/components/page/page_header/page_header_content.tsx
@@ -22,14 +22,13 @@ import classNames from 'classnames';
import { CommonProps } from '../../common';
import { EuiIcon, IconType } from '../../icon';
import { EuiTab, EuiTabs, EuiTabsProps } from '../../tabs';
-import { EuiPageHeaderSection } from './page_header_section';
import { EuiFlexGroup, EuiFlexItem } from '../../flex';
import { EuiSpacer } from '../../spacer';
import { EuiTitle } from '../../title';
import { EuiText } from '../../text';
+import { useIsWithinBreakpoints } from '../../../services/hooks';
-export const ALIGN_ITEMS = ['top', 'bottom', 'middle'] as const;
-export const RESPONSIVE_ORDER = ['leftFirst', 'rightFirst'] as const;
+export const ALIGN_ITEMS = ['top', 'bottom', 'center'] as const;
// Gets all the tab props including the button or link props
type EuiTabProps = React.ComponentProps & {
@@ -83,84 +82,53 @@ export type EuiPageHeaderContentProps = CommonProps &
HTMLAttributes &
EuiPageHeaderContentLeft & {
/**
- * Set to false if you don't want the children to stack
- * at small screen sizes.
+ * Set to false if you don't want the children to stack at small screen sizes.
+ * Set to `reverse` to display the right side content first for the sack of hierarchy (like global time)
*/
- responsive?: boolean;
+ responsive?: boolean | 'reverse';
/**
* Pass custom an array of content to this side usually up to 3 buttons.
* The first button should be primary, usually with `fill` and will be visually displayed as the last item,
* but first in the tab order
*/
rightSideContent?: ReactNode[];
- /**
- * Sets the max-width of the page,
- * set to `true` to use the default size of `1000px (1200 for Amsterdam)`,
- * set to `false` to not restrict the width,
- * set to a number for a custom width in px,
- * set to a string for a custom width in custom measurement.
- */
- restrictWidth?: boolean | number | string;
/**
* Vertical alignment of the left and right side content;
- * Default is `top` or dependendent on content
+ * Default is `middle` for custom content, but `top` for when `pageTitle` or `tabs` are included
*/
alignItems?: typeof ALIGN_ITEMS[number];
- /**
- * Which content to display first when on smaller screens.
- * Useful when the right side content should actually come beforehand in the hierarchy (like time)
- */
- responsiveOrder?: typeof RESPONSIVE_ORDER[number];
/**
* Whether the array of right side items should all break to their own line on small screens
*/
rightSideResponsive?: boolean;
/**
- * Custom children will be rendered before the `tabs` unless no `pageTitle` is present, then it will be the last item
+ * Custom children will be rendered before the `tabs` unless no `pageTitle` is present,
+ * then it will be the last item
*/
children?: ReactNode;
};
export const EuiPageHeaderContent: FunctionComponent = ({
+ className,
pageTitle,
iconType,
- description,
tabs,
tabsProps,
- className,
+ description,
rightSideContent,
- restrictWidth = false,
- alignItems = 'center',
- responsiveOrder = 'leftFirst',
+ alignItems = 'top',
+ responsive = true,
rightSideResponsive = false,
children,
- responsive = true,
- style,
...rest
}) => {
- let widthClassname;
- let newStyle;
-
- if (restrictWidth === true) {
- widthClassname = 'EuiPageHeaderContent--restrictWidth-default';
- } else if (restrictWidth !== false) {
- widthClassname = 'EuiPageHeaderContent--restrictWidth-custom';
- newStyle = { ...style, maxWidth: restrictWidth };
- }
-
- const classes = classNames(
- 'EuiPageHeaderContent',
- {
- 'EuiPageHeaderContent--responsive': responsive,
- 'EuiPageHeaderContent--column': !children,
- 'EuiPageHeaderContent--tabsAtBottom': pageTitle && tabs,
- 'EuiPageHeaderContent--responsiveReverse':
- !children && responsiveOrder === 'rightFirst',
- },
- widthClassname,
- `EuiPageHeaderContent--${alignItems}`
+ const isResponsiveBreakpoint = useIsWithinBreakpoints(
+ ['xs', 's'],
+ !!responsive
);
+ const classes = classNames('euiPageHeaderContent');
+
let descriptionNode;
if (description) {
descriptionNode = (
@@ -177,7 +145,7 @@ export const EuiPageHeaderContent: FunctionComponent
if (pageTitle) {
const icon = iconType ? (
@@ -219,7 +187,7 @@ export const EuiPageHeaderContent: FunctionComponent
let leftSideContentNode = children;
if (children && (tabsNode || pageTitleNode)) {
leftSideContentNode = (
-
The left side allows you to pass any combination of{' '}
pageTitle, description,{' '}
- tabs, or any leftSideContent.
- The order of which are determined by the particular combination.
+ tabs, or any children. The
+ order of which are determined by the particular combination.
The right side, rightSideContent, allows for just
@@ -199,9 +199,8 @@ export const PageExample = {
When using supplying tabs without a{' '}
pageTitle, EuiPageHeader will
promote those tabs as if they are the page title. This means that
- any description, or{' '}
- leftSideContent will sit below{' '}
- the tabs.
+ any description, or children{' '}
+ will sit below the tabs.
>
),
@@ -232,10 +231,7 @@ export const PageExample = {
completely optional and by nature, inflexible. If you need a layout
that does not match these patterns you can simply pass in your own{' '}
children utilizing the{' '}
- EuiPageHeaderSection components. Do note, that when
- supplying children,{' '}
- EuiPageHeader will completely ignore any other
- content props and only render the children.
+ EuiPageHeaderSection components.
>
),
diff --git a/src-docs/src/views/page/playground.js b/src-docs/src/views/page/playground.js
index 2c0c852eb7a2..f3cf318fb980 100644
--- a/src-docs/src/views/page/playground.js
+++ b/src-docs/src/views/page/playground.js
@@ -2,11 +2,7 @@
import React from 'react';
import { PropTypes } from 'react-view';
-import {
- EuiPageHeaderContent,
- EuiButton,
- EuiText,
-} from '../../../../src/components/';
+import { EuiPageHeader, EuiButton, EuiText } from '../../../../src/components/';
import {
propUtilityForPlayground,
iconValidator,
@@ -29,9 +25,9 @@ const rightSideContent = [
];
export default () => {
- const docgenInfo = Array.isArray(EuiPageHeaderContent.__docgenInfo)
- ? EuiPageHeaderContent.__docgenInfo[0]
- : EuiPageHeaderContent.__docgenInfo;
+ const docgenInfo = Array.isArray(EuiPageHeader.__docgenInfo)
+ ? EuiPageHeader.__docgenInfo[0]
+ : EuiPageHeader.__docgenInfo;
const propsToUse = propUtilityForPlayground(docgenInfo.props);
propsToUse.iconType = iconValidator(propsToUse.iconType);
@@ -42,11 +38,6 @@ export default () => {
value: 'Page title',
};
- propsToUse.leftSideContent = {
- ...propsToUse.leftSideContent,
- type: PropTypes.String,
- };
-
// HELP: NOT WORKING
propsToUse.alignItems = {
...propsToUse.alignItems,
@@ -55,6 +46,7 @@ export default () => {
propsToUse.description = {
...propsToUse.description,
+ value: 'Example of a description.',
type: PropTypes.String,
};
@@ -64,26 +56,21 @@ export default () => {
};
propsToUse.children = {
- value: `
-
- Any content children of EuiPageHeaderContent will appear here.
-
-`;
-
-exports[`EuiPageHeaderContent props tabs is rendered with tabsProps 1`] = `
-
-
-
-
-
-
- Tab 1
-
-
-
-
- Tab 2
-
-
-
-
-
-
-`;
diff --git a/src/components/page/page_header/__snapshots__/page_header_content.test.tsx.snap b/src/components/page/page_header/__snapshots__/page_header_content.test.tsx.snap
index 776ce34d6c35..b404edb405c7 100644
--- a/src/components/page/page_header/__snapshots__/page_header_content.test.tsx.snap
+++ b/src/components/page/page_header/__snapshots__/page_header_content.test.tsx.snap
@@ -100,6 +100,48 @@ exports[`EuiPageHeaderContent props alignItems center is rendered 1`] = `
`;
+exports[`EuiPageHeaderContent props alignItems stretch is rendered 1`] = `
+
+
+
+
+ Page title
+
+
+
+
+
+
+ Button 1
+
+
+
+
+ Button 2
+
+
+
+
+
+
+`;
+
exports[`EuiPageHeaderContent props alignItems top is rendered 1`] = `
Button 1,
+ Button 2,
+];
describe('EuiPageHeader', () => {
test('is rendered', () => {
diff --git a/src/components/page/page_header/page_header.tsx b/src/components/page/page_header/page_header.tsx
index 7044187cee8f..27e9635eb61c 100644
--- a/src/components/page/page_header/page_header.tsx
+++ b/src/components/page/page_header/page_header.tsx
@@ -25,8 +25,6 @@ import {
EuiPageHeaderContentProps,
} from './page_header_content';
-export const ALIGN_ITEMS = ['top', 'bottom', 'center'] as const;
-
export type EuiPageHeaderProps = CommonProps &
HTMLAttributes &
EuiPageHeaderContentProps & {
diff --git a/src/components/page/page_header/page_header_content.tsx b/src/components/page/page_header/page_header_content.tsx
index 24f330d8d1fd..32eb11b251ca 100644
--- a/src/components/page/page_header/page_header_content.tsx
+++ b/src/components/page/page_header/page_header_content.tsx
@@ -29,7 +29,7 @@ import { EuiText } from '../../text';
import { useIsWithinBreakpoints } from '../../../services/hooks';
import { Props as EuiTabProps } from '../../../components/tabs/tab';
-export const ALIGN_ITEMS = ['top', 'bottom', 'center'] as const;
+export const ALIGN_ITEMS = ['top', 'bottom', 'center', 'stretch'] as const;
// Gets all the tab props including the button or link props
type Tab = EuiTabProps & {
@@ -273,7 +273,7 @@ export const EuiPageHeaderContent: FunctionComponent
{leftSideOrder}
From 27d7815737e71716beb302790148ae4750b7fdf4 Mon Sep 17 00:00:00 2001
From: cchaos
Date: Wed, 3 Feb 2021 11:35:02 -0500
Subject: [PATCH 18/27] cl & comments
---
CHANGELOG.md | 7 +++++++
.../page/page_header/page_header_content.test.tsx | 4 ++--
src/services/hooks/useIsWithinBreakpoints.ts | 1 +
3 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e1451858e10d..bdc6cd62a9ad 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,12 +1,19 @@
## [`master`](https://github.com/elastic/eui/tree/master)
- Added `isLoading` prop and added `EuiOverlayMask` directly to `EuiConfirmModal` ([#4421](https://github.com/elastic/eui/pull/4421))
+- Added content-specific props (`pageTitle`, `description`, `tabs`, `rightSideContent`) to `EuiPageHeader` by creating a new `EuiPageHeaderContent` component ([#4451](https://github.com/elastic/eui/pull/4451))
+- Added `isActive` parameter to the `useIsWithinBreakpoints` hook ([#4451](https://github.com/elastic/eui/pull/4451))
**Bug fixes**
- Fixed `id` usage throughout `EuiTreeView` to respect custom ids and stop conflicts in generated ids ([#4435](https://github.com/elastic/eui/pull/4435))
- Fixed `EuiTabs` `role` if no tabs are passed in ([#4435](https://github.com/elastic/eui/pull/4435))
+**Theme: Amsterdam**
+
+- Increased `EuiPage`'s default `restrictWidth` size to `1200px` (extra large breakpoint) ([#4451](https://github.com/elastic/eui/pull/4451))
+- Reduced size of `euiBottomShadowSmall` by one layer ([#4451](https://github.com/elastic/eui/pull/4451))
+
## [`31.4.0`](https://github.com/elastic/eui/tree/v31.4.0)
- Added `getDefaultEuiMarkdownProcessingPlugins` method for better control over `EuiMarkdownEditor`'s toolbar UI ([#4383](https://github.com/elastic/eui/pull/4383))
diff --git a/src/components/page/page_header/page_header_content.test.tsx b/src/components/page/page_header/page_header_content.test.tsx
index df0e3e440011..851244115b3a 100644
--- a/src/components/page/page_header/page_header_content.test.tsx
+++ b/src/components/page/page_header/page_header_content.test.tsx
@@ -27,7 +27,7 @@ import {
EuiPageHeaderContentProps,
} from './page_header_content';
-export const tabs: EuiPageHeaderContentProps['tabs'] = [
+const tabs: EuiPageHeaderContentProps['tabs'] = [
{
label: 'Tab 1',
isSelected: true,
@@ -37,7 +37,7 @@ export const tabs: EuiPageHeaderContentProps['tabs'] = [
},
];
-export const rightSideContent: EuiPageHeaderContentProps['rightSideContent'] = [
+const rightSideContent: EuiPageHeaderContentProps['rightSideContent'] = [
Button 1,
Button 2,
];
diff --git a/src/services/hooks/useIsWithinBreakpoints.ts b/src/services/hooks/useIsWithinBreakpoints.ts
index 8e3b263d1599..17ffa46a17de 100644
--- a/src/services/hooks/useIsWithinBreakpoints.ts
+++ b/src/services/hooks/useIsWithinBreakpoints.ts
@@ -27,6 +27,7 @@ import { isWithinBreakpoints, EuiBreakpointSize } from '../breakpoint';
* falls within any of the named breakpoints.
*
* @param {EuiBreakpointSize[]} sizes An array of named breakpoints
+ * @param {boolean} isActive Manages whether the resize handler should be active
* @returns {boolean} Returns `true` if current breakpoint name is included in `sizes`
*/
export function useIsWithinBreakpoints(
From 18a429b9d3f3e19985381f7fd1b8a8da7335fa0a Mon Sep 17 00:00:00 2001
From: Dave Snider
Date: Wed, 3 Feb 2021 21:22:28 -0800
Subject: [PATCH 19/27] Docs clarity
---
src-docs/src/views/page/page.js | 19 ++-
src-docs/src/views/page/page_example.js | 191 +++++++++++++-----------
2 files changed, 123 insertions(+), 87 deletions(-)
diff --git a/src-docs/src/views/page/page.js b/src-docs/src/views/page/page.js
index a132c42320a7..47bb37476ea6 100644
--- a/src-docs/src/views/page/page.js
+++ b/src-docs/src/views/page/page.js
@@ -10,13 +10,30 @@ import {
EuiPageHeader,
EuiPageSideBar,
EuiTitle,
+ EuiButton,
} from '../../../../src/components';
export default () => (
SideBar nav
-
+ Add something,
+ Do something,
+ ]}
+ />
diff --git a/src-docs/src/views/page/page_example.js b/src-docs/src/views/page/page_example.js
index 9d2f83f92604..5def084c3b0c 100644
--- a/src-docs/src/views/page/page_example.js
+++ b/src-docs/src/views/page/page_example.js
@@ -67,7 +67,7 @@ export const PageExample = {
),
sections: [
{
- title: 'Page with everything on',
+ title: 'A full page layout with everything on',
source: [
{
type: GuideSectionTypes.JS,
@@ -80,6 +80,29 @@ export const PageExample = {
],
text: (
+
+ EUI provides a family of components using the{' '}
+ EuiPage prefix that work together to build
+ consistant page layouts that work responsively. The below example
+ utilizes the following major components
+
+
+
+ EuiPage provides the overall wrapper.
+
+
+ EuiPageHeader provides a title, description and
+ section for actions.
+
+
+ EuiPageContent and its family of related
+ components provide the main content container.
+
+
+ EuiPageSideBar provides a way to provide a
+ menu.
+
+
By default, the entire page will always be 100% of the window's
width; to max out the typical width and center the page, set the{' '}
@@ -107,7 +130,7 @@ export const PageExample = {
),
},
{
- title: 'Simple page with title',
+ title: 'A simple page layout with a title',
source: [
{
type: GuideSectionTypes.JS,
@@ -132,7 +155,75 @@ export const PageExample = {
),
},
{
- title: 'Page header',
+ title: 'A simple page layout with content only',
+ source: [
+ {
+ type: GuideSectionTypes.JS,
+ code: pageContentOnlySource,
+ },
+ {
+ type: GuideSectionTypes.HTML,
+ code: pageContentOnlyHtml,
+ },
+ ],
+ text:
We can further simplify pages by only showing the content.
- EuiPageHeader comes with some pre-determined
- content that you can apply to the left and right sides of the
- component.
-
-
- The left side allows you to pass any combination of{' '}
+ EuiPageHeader provides props for opinionated,
+ consistant formatting of your header. Any combination of
pageTitle, description,{' '}
- tabs, or any children. The
- order of which are determined by the particular combination.
+ tabs, or any children will
+ adjust the layout as needed.
- The right side, rightSideContent, allows for just
- a simple array of nodes which are placed within a
- flexbox row. This is usually in the form of multiple buttons, of
- which, at least one is primary (or{' '}
+ An additional prop rightSideContent allows for a
+ simple array of nodes which will layout in a
+ flexbox row. This is commonly used for adding multiple buttons, of
+ which, at least should be primary (or{' '}
{'fill="true"'}). These items are
also displayed in reverse order so that the first
- and primary action will be displayed far right.
+ and primary array item will be displayed on the far right.
- EuiPageHeader provides a title, description and
- section for actions.
+ EuiPageHeader provides a title, description,
+ tabs and section for actions.
EuiPageContent and its family of related
components provide the main content container.
- EuiPageSideBar provides a way to provide a
- menu.
+ EuiPageSideBar provides a way to add a menu.
EUI provides a family of components using the{' '}
EuiPage prefix that work together to build
- consistant page layouts that work responsively. The below example
- utilizes the following major components
+ consistent page layouts that work responsively.
- EuiPage provides the overall wrapper.
+ EuiPage provides the overall wrapper.
- EuiPageHeader provides a title, description,
- tabs and section for actions.
+ EuiPageHeader provides a title, description,
+ section for actions and possible tabs.
- EuiPageContent and its family of related
+ EuiPageContent and its family of related
components provide the main content container.
- EuiPageSideBar provides a way to add a menu.
+ EuiPageSideBar provides a way to add side navigation.
@@ -222,7 +221,7 @@ export const PageExample = {
),
},
{
- title: 'The EuiPageHeader component in more detail',
+ title: 'The page header in detail',
source: [
{
type: GuideSectionTypes.JS,
@@ -246,7 +245,7 @@ export const PageExample = {
An additional prop rightSideContent allows for a
simple array of nodes which will layout in a
flexbox row. This is commonly used for adding multiple buttons, of
- which, at least should be primary (or{' '}
+ which, at least one should be primary (or{' '}
{'fill="true"'}). These items are
also displayed in reverse order so that the first
and primary array item will be displayed on the far right.
@@ -280,7 +279,7 @@ export const PageExample = {
/>`,
},
{
- title: 'Adding tabs to EuiPageHeader',
+ title: 'Tabs in the page header',
source: [
{
type: GuideSectionTypes.JS,
@@ -317,7 +316,7 @@ export const PageExample = {
/>`,
},
{
- title: 'Customizing EuiPageHeader',
+ title: 'Customizing the page header',
source: [
{
type: GuideSectionTypes.JS,
From fb2c6b980f621e230392b2d8354ac07dc6c49ec6 Mon Sep 17 00:00:00 2001
From: cchaos
Date: Mon, 8 Feb 2021 12:10:21 -0500
Subject: [PATCH 22/27] Render `` element in EuiPageHeader
---
src-docs/src/views/page/page_example.js | 5 +--
.../__snapshots__/page_header.test.tsx.snap | 32 +++++++++----------
.../page/page_header/page_header.tsx | 10 +++---
3 files changed, 24 insertions(+), 23 deletions(-)
diff --git a/src-docs/src/views/page/page_example.js b/src-docs/src/views/page/page_example.js
index 39871fd116a9..c1ddbb3b2ea1 100644
--- a/src-docs/src/views/page/page_example.js
+++ b/src-docs/src/views/page/page_example.js
@@ -83,7 +83,7 @@ export const PageExample = {
EUI provides a family of components using the{' '}
EuiPage prefix that work together to build
- consistent page layouts that work responsively.
+ consistent page layouts that work responsively.
@@ -98,7 +98,8 @@ export const PageExample = {
components provide the main content container.
- EuiPageSideBar provides a way to add side navigation.
+ EuiPageSideBar provides a way to add side
+ navigation.
diff --git a/src/components/page/page_header/__snapshots__/page_header.test.tsx.snap b/src/components/page/page_header/__snapshots__/page_header.test.tsx.snap
index 2d8b9d53da51..b9c6289f6366 100644
--- a/src/components/page/page_header/__snapshots__/page_header.test.tsx.snap
+++ b/src/components/page/page_header/__snapshots__/page_header.test.tsx.snap
@@ -1,17 +1,17 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`EuiPageHeader is rendered 1`] = `
-
+`;
+
exports[`EuiPageHeaderContent props responsive is rendered as false 1`] = `
{
= ({
// Page header content only props:
pageTitle,
iconType,
+ iconProps,
tabs,
tabsProps,
description,
@@ -95,6 +96,7 @@ export const EuiPageHeader: FunctionComponent = ({
responsive={responsive}
pageTitle={pageTitle}
iconType={iconType}
+ iconProps={iconProps}
tabs={tabs}
tabsProps={tabsProps}
description={description}
diff --git a/src/components/page/page_header/page_header_content.test.tsx b/src/components/page/page_header/page_header_content.test.tsx
index 851244115b3a..271b26626c70 100644
--- a/src/components/page/page_header/page_header_content.test.tsx
+++ b/src/components/page/page_header/page_header_content.test.tsx
@@ -66,6 +66,18 @@ describe('EuiPageHeaderContent', () => {
expect(component).toMatchSnapshot();
});
+
+ test('is rendered with icon and iconProps', () => {
+ const component = render(
+
+ );
+
+ expect(component).toMatchSnapshot();
+ });
});
describe('tabs', () => {
diff --git a/src/components/page/page_header/page_header_content.tsx b/src/components/page/page_header/page_header_content.tsx
index 32eb11b251ca..e8e10137996a 100644
--- a/src/components/page/page_header/page_header_content.tsx
+++ b/src/components/page/page_header/page_header_content.tsx
@@ -20,7 +20,7 @@
import React, { FunctionComponent, ReactNode, HTMLAttributes } from 'react';
import classNames from 'classnames';
import { CommonProps } from '../../common';
-import { EuiIcon, IconType } from '../../icon';
+import { EuiIcon, EuiIconProps, IconType } from '../../icon';
import { EuiTab, EuiTabs, EuiTabsProps } from '../../tabs';
import { EuiFlexGroup, EuiFlexItem } from '../../flex';
import { EuiSpacer } from '../../spacer';
@@ -49,6 +49,10 @@ export type EuiPageHeaderContentTitle = {
* Optional icon to place to the left of the title
*/
iconType?: IconType;
+ /**
+ * Additional EuiIcon props to apply to the optional icon
+ */
+ iconProps?: Partial;
};
export type EuiPageHeaderContentTabs = {
@@ -103,8 +107,7 @@ export type EuiPageHeaderContentProps = CommonProps &
*/
rightSideResponsive?: boolean;
/**
- * Custom children will be rendered before the `tabs` unless no `pageTitle` is present,
- * then it will be the last item
+ * Custom children will be rendered before the `tabs` unless no `pageTitle` is present, then it will be the last item
*/
children?: ReactNode;
};
@@ -113,6 +116,7 @@ export const EuiPageHeaderContent: FunctionComponent
className,
pageTitle,
iconType,
+ iconProps,
tabs,
tabsProps,
description,
@@ -146,9 +150,13 @@ export const EuiPageHeaderContent: FunctionComponent
if (pageTitle) {
const icon = iconType ? (
) : undefined;
From e3f1ce1cdea837d2e613186979d847d8f8d2779f Mon Sep 17 00:00:00 2001
From: cchaos
Date: Mon, 8 Feb 2021 12:28:45 -0500
Subject: [PATCH 24/27] Renaming `rightSideContent` to `rightSideItems` for
better clarity of what the prop type is
---
CHANGELOG.md | 2 +-
src-docs/src/views/page/page.js | 2 +-
.../page/page_content_center_with_side_bar.js | 2 +-
src-docs/src/views/page/page_example.js | 8 ++++----
src-docs/src/views/page/page_header.js | 2 +-
src-docs/src/views/page/page_header_tabs.js | 2 +-
src-docs/src/views/page/playground.js | 12 ++++++------
src-docs/src/views/tour/fullscreen.js | 2 +-
.../__snapshots__/page_header.test.tsx.snap | 10 +++++-----
.../page_header_content.test.tsx.snap | 18 +++++++++---------
.../page/page_header/_page_header_content.scss | 2 +-
.../page/page_header/page_header.test.tsx | 6 +++---
.../page/page_header/page_header.tsx | 6 +++---
.../page_header/page_header_content.test.tsx | 12 ++++++------
.../page/page_header/page_header_content.tsx | 10 +++++-----
15 files changed, 48 insertions(+), 48 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index bdc6cd62a9ad..5990c228d8ae 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,7 +1,7 @@
## [`master`](https://github.com/elastic/eui/tree/master)
- Added `isLoading` prop and added `EuiOverlayMask` directly to `EuiConfirmModal` ([#4421](https://github.com/elastic/eui/pull/4421))
-- Added content-specific props (`pageTitle`, `description`, `tabs`, `rightSideContent`) to `EuiPageHeader` by creating a new `EuiPageHeaderContent` component ([#4451](https://github.com/elastic/eui/pull/4451))
+- Added content-specific props (`pageTitle`, `description`, `tabs`, `rightSideItems`) to `EuiPageHeader` by creating a new `EuiPageHeaderContent` component ([#4451](https://github.com/elastic/eui/pull/4451))
- Added `isActive` parameter to the `useIsWithinBreakpoints` hook ([#4451](https://github.com/elastic/eui/pull/4451))
**Bug fixes**
diff --git a/src-docs/src/views/page/page.js b/src-docs/src/views/page/page.js
index 2a98e36005c2..d6d4eca6e776 100644
--- a/src-docs/src/views/page/page.js
+++ b/src-docs/src/views/page/page.js
@@ -20,7 +20,7 @@ export default () => (
Add something,
Do something,
]}
diff --git a/src-docs/src/views/page/page_content_center_with_side_bar.js b/src-docs/src/views/page/page_content_center_with_side_bar.js
index 5ff4cb412dc0..27e97f9aa337 100644
--- a/src-docs/src/views/page/page_content_center_with_side_bar.js
+++ b/src-docs/src/views/page/page_content_center_with_side_bar.js
@@ -19,7 +19,7 @@ export default () => (
diff --git a/src-docs/src/views/page/page_example.js b/src-docs/src/views/page/page_example.js
index e4de08fe34ec..a84baa69ba26 100644
--- a/src-docs/src/views/page/page_example.js
+++ b/src-docs/src/views/page/page_example.js
@@ -237,13 +237,13 @@ export const PageExample = {
<>
EuiPageHeader provides props for opinionated,
- consistant formatting of your header. Any combination of
+ consistent formatting of your header. Any combination of{' '}
pageTitle, description,{' '}
tabs, or any children will
adjust the layout as needed.
- An additional prop rightSideContent allows for a
+ An additional prop rightSideItems allows for a
simple array of nodes which will layout in a
flexbox row. This is commonly used for adding multiple buttons, of
which, at least one should be primary (or{' '}
@@ -255,7 +255,7 @@ export const PageExample = {
You can further adjust the display of these content types with an
optional iconType placed to the left of the
title, alignItems for adjusting the vertical
- alignment of the two sides, and responsiveOrder
+ alignment of the two sides, and responsiveOrder{' '}
to determine which content side to display first on smaller screens.
>
@@ -273,7 +273,7 @@ export const PageExample = {
{ label:"Tab 2" }
]}
description="Example of a description."
- rightSideContent={[
+ rightSideItems={[
Button 1,
Button 2
]}
diff --git a/src-docs/src/views/page/page_header.js b/src-docs/src/views/page/page_header.js
index 085149d8c907..239c9a704f0b 100644
--- a/src-docs/src/views/page/page_header.js
+++ b/src-docs/src/views/page/page_header.js
@@ -21,7 +21,7 @@ export default () => (
},
]}
description="This description should be describing the current page as depicted by the page title. It has the grow prop set to false on the EuiText block so that it is the proper line length. And it will also never extend beneath the right side content (buttons)."
- rightSideContent={[
+ rightSideItems={[
Add something,
Do something,
]}>
diff --git a/src-docs/src/views/page/page_header_tabs.js b/src-docs/src/views/page/page_header_tabs.js
index 06b19a5461ed..6c92df0e8aca 100644
--- a/src-docs/src/views/page/page_header_tabs.js
+++ b/src-docs/src/views/page/page_header_tabs.js
@@ -19,7 +19,7 @@ export default () => (
},
]}
description="This description should be describing the currently selected tab. It has the grow prop set to false on the EuiText block so that it is the proper line length. And it will also never extend beneath the right side content (buttons)."
- rightSideContent={[
+ rightSideItems={[
Add something,
Do something,
]}>
diff --git a/src-docs/src/views/page/playground.js b/src-docs/src/views/page/playground.js
index 62734838ae61..6be4412b5f9b 100644
--- a/src-docs/src/views/page/playground.js
+++ b/src-docs/src/views/page/playground.js
@@ -26,13 +26,13 @@ const tabs = `[
},
]`;
-const rightSideContent = `[
+const rightSideItems = `[
Button 1,
Button 2,
]`;
// TODO: Try later to find build a toggle that allows switching between different types of content to pass
-// const rightSideContent =
+// const rightSideItems =
// '[]';
export default () => {
@@ -55,10 +55,10 @@ export default () => {
type: PropTypes.String,
};
- propsToUse.rightSideContent = simulateFunction({
- ...propsToUse.rightSideContent,
+ propsToUse.rightSideItems = simulateFunction({
+ ...propsToUse.rightSideItems,
custom: {
- value: rightSideContent,
+ value: rightSideItems,
},
});
@@ -92,7 +92,7 @@ export default () => {
named: ['EuiPageHeader', 'EuiButton', 'EuiTabs', 'EuiImage'],
},
},
- customProps: generateCustomProps(['rightSideContent', 'tabs']),
+ customProps: generateCustomProps(['rightSideItems', 'tabs']),
},
};
};
diff --git a/src-docs/src/views/tour/fullscreen.js b/src-docs/src/views/tour/fullscreen.js
index df718dbee293..07e46c8083f2 100644
--- a/src-docs/src/views/tour/fullscreen.js
+++ b/src-docs/src/views/tour/fullscreen.js
@@ -179,7 +179,7 @@ export default () => {
setIsFullScreen(false)}
diff --git a/src/components/page/page_header/__snapshots__/page_header.test.tsx.snap b/src/components/page/page_header/__snapshots__/page_header.test.tsx.snap
index 23379cc31011..3f11d6db6ca5 100644
--- a/src/components/page/page_header/__snapshots__/page_header.test.tsx.snap
+++ b/src/components/page/page_header/__snapshots__/page_header.test.tsx.snap
@@ -33,7 +33,7 @@ exports[`EuiPageHeader props alignItems bottom is rendered 1`] = `
class="euiFlexItem euiFlexItem--flexGrowZero"
>
`;
-exports[`EuiPageHeaderContent props rightSideContent is rendered 1`] = `
+exports[`EuiPageHeaderContent props rightSideItems is rendered 1`] = `
`;
-exports[`EuiPageHeaderContent props rightSideContent is rendered with rightSideResponsive as true 1`] = `
+exports[`EuiPageHeaderContent props rightSideItems is rendered with rightSideResponsive as true 1`] = `
@@ -482,7 +482,7 @@ exports[`EuiPageHeaderContent props rightSideContent is rendered with rightSideR
class="euiFlexItem euiFlexItem--flexGrowZero"
>
@@ -75,7 +75,7 @@ describe('EuiPageHeader', () => {
const component = render(
);
diff --git a/src/components/page/page_header/page_header.tsx b/src/components/page/page_header/page_header.tsx
index 01f280c57a88..f424ad7f7311 100644
--- a/src/components/page/page_header/page_header.tsx
+++ b/src/components/page/page_header/page_header.tsx
@@ -55,7 +55,7 @@ export const EuiPageHeader: FunctionComponent = ({
tabs,
tabsProps,
description,
- rightSideContent,
+ rightSideItems,
rightSideResponsive,
...rest
}) => {
@@ -81,7 +81,7 @@ export const EuiPageHeader: FunctionComponent = ({
className
);
- if (!pageTitle && !tabs && !description && !rightSideContent) {
+ if (!pageTitle && !tabs && !description && !rightSideItems) {
return (
{children}
@@ -100,7 +100,7 @@ export const EuiPageHeader: FunctionComponent = ({
tabs={tabs}
tabsProps={tabsProps}
description={description}
- rightSideContent={rightSideContent}
+ rightSideItems={rightSideItems}
rightSideResponsive={rightSideResponsive}>
{children}
diff --git a/src/components/page/page_header/page_header_content.test.tsx b/src/components/page/page_header/page_header_content.test.tsx
index 271b26626c70..92ba2224017b 100644
--- a/src/components/page/page_header/page_header_content.test.tsx
+++ b/src/components/page/page_header/page_header_content.test.tsx
@@ -37,7 +37,7 @@ const tabs: EuiPageHeaderContentProps['tabs'] = [
},
];
-const rightSideContent: EuiPageHeaderContentProps['rightSideContent'] = [
+const rightSideItems: EuiPageHeaderContentProps['rightSideItems'] = [
Button 1,
Button 2,
];
@@ -118,10 +118,10 @@ describe('EuiPageHeaderContent', () => {
});
});
- describe('rightSideContent', () => {
+ describe('rightSideItems', () => {
test('is rendered', () => {
const component = render(
-
+
);
expect(component).toMatchSnapshot();
@@ -130,7 +130,7 @@ describe('EuiPageHeaderContent', () => {
test('is rendered with rightSideResponsive as true', () => {
const component = render(
);
@@ -153,7 +153,7 @@ describe('EuiPageHeaderContent', () => {
+ rightSideItems={rightSideItems}>
Child
);
@@ -168,7 +168,7 @@ describe('EuiPageHeaderContent', () => {
const component = render(
);
diff --git a/src/components/page/page_header/page_header_content.tsx b/src/components/page/page_header/page_header_content.tsx
index e8e10137996a..293232130580 100644
--- a/src/components/page/page_header/page_header_content.tsx
+++ b/src/components/page/page_header/page_header_content.tsx
@@ -96,7 +96,7 @@ export type EuiPageHeaderContentProps = CommonProps &
* The first button should be primary, usually with `fill` and will be visually displayed as the last item,
* but first in the tab order
*/
- rightSideContent?: ReactNode[];
+ rightSideItems?: ReactNode[];
/**
* Vertical alignment of the left and right side content;
* Default is `middle` for custom content, but `top` for when `pageTitle` or `tabs` are included
@@ -120,7 +120,7 @@ export const EuiPageHeaderContent: FunctionComponent
tabs,
tabsProps,
description,
- rightSideContent,
+ rightSideItems,
alignItems = 'top',
responsive = true,
rightSideResponsive = false,
@@ -232,9 +232,9 @@ export const EuiPageHeaderContent: FunctionComponent
}
let rightSideFlexItem;
- if (rightSideContent && rightSideContent.length) {
+ if (rightSideItems && rightSideItems.length) {
const wrapWithFlex = () => {
- return rightSideContent.map((item, index) => {
+ return rightSideItems.map((item, index) => {
return (
{item}
@@ -246,7 +246,7 @@ export const EuiPageHeaderContent: FunctionComponent
rightSideFlexItem = (
{wrapWithFlex()}
From f0964c0b7125ef7701e9d8951cc85654157bd024 Mon Sep 17 00:00:00 2001
From: cchaos
Date: Mon, 8 Feb 2021 12:52:56 -0500
Subject: [PATCH 25/27] Replacing `rightSideResponsive` with a more generic
`rightSideGroupProps`
Also had to change the EuiFlexGroupProps to include ALL props (like Common)
---
src/components/flex/flex_group.tsx | 8 ++---
src/components/flex/index.ts | 6 +++-
.../__snapshots__/page_header.test.tsx.snap | 4 ++-
.../page_header_content.test.tsx.snap | 6 ++--
.../page/page_header/page_header.test.tsx | 2 +-
.../page/page_header/page_header.tsx | 4 +--
.../page_header/page_header_content.test.tsx | 4 +--
.../page/page_header/page_header_content.tsx | 30 +++++++++++--------
8 files changed, 38 insertions(+), 26 deletions(-)
diff --git a/src/components/flex/flex_group.tsx b/src/components/flex/flex_group.tsx
index 72c1fa8f5161..e3ae0de1cdde 100644
--- a/src/components/flex/flex_group.tsx
+++ b/src/components/flex/flex_group.tsx
@@ -27,7 +27,9 @@ export type FlexGroupDirection = keyof typeof directionToClassNameMap;
export type FlexGroupGutterSize = keyof typeof gutterSizeToClassNameMap;
export type FlexGroupJustifyContent = keyof typeof justifyContentToClassNameMap;
-export interface EuiFlexGroupProps {
+export interface EuiFlexGroupProps
+ extends CommonProps,
+ HTMLAttributes {
alignItems?: FlexGroupAlignItems;
component?: FlexGroupComponentType;
direction?: FlexGroupDirection;
@@ -87,9 +89,7 @@ const isValidElement = (
export const EuiFlexGroup = forwardRef<
HTMLDivElement | HTMLSpanElement,
- CommonProps &
- HTMLAttributes &
- EuiFlexGroupProps
+ EuiFlexGroupProps
>(
(
{
diff --git a/src/components/flex/index.ts b/src/components/flex/index.ts
index 5ea60b7ceaa8..f9804e43cb5f 100644
--- a/src/components/flex/index.ts
+++ b/src/components/flex/index.ts
@@ -17,7 +17,11 @@
* under the License.
*/
-export { EuiFlexGroup, EuiFlexGroupGutterSize } from './flex_group';
+export {
+ EuiFlexGroup,
+ EuiFlexGroupProps,
+ EuiFlexGroupGutterSize,
+} from './flex_group';
export { EuiFlexGrid } from './flex_grid';
diff --git a/src/components/page/page_header/__snapshots__/page_header.test.tsx.snap b/src/components/page/page_header/__snapshots__/page_header.test.tsx.snap
index 3f11d6db6ca5..a30fad4cb450 100644
--- a/src/components/page/page_header/__snapshots__/page_header.test.tsx.snap
+++ b/src/components/page/page_header/__snapshots__/page_header.test.tsx.snap
@@ -233,7 +233,9 @@ exports[`EuiPageHeader props page content props are passed down is rendered 1`]
class="euiFlexItem euiFlexItem--flexGrowZero"
>
`;
-exports[`EuiPageHeaderContent props rightSideItems is rendered with rightSideResponsive as true 1`] = `
+exports[`EuiPageHeaderContent props rightSideItems is rendered with rightSideGroupProps 1`] = `
@@ -482,7 +482,9 @@ exports[`EuiPageHeaderContent props rightSideItems is rendered with rightSideRes
class="euiFlexItem euiFlexItem--flexGrowZero"
>
);
diff --git a/src/components/page/page_header/page_header.tsx b/src/components/page/page_header/page_header.tsx
index f424ad7f7311..8df58ceff1c2 100644
--- a/src/components/page/page_header/page_header.tsx
+++ b/src/components/page/page_header/page_header.tsx
@@ -56,7 +56,7 @@ export const EuiPageHeader: FunctionComponent = ({
tabsProps,
description,
rightSideItems,
- rightSideResponsive,
+ rightSideGroupProps,
...rest
}) => {
let widthClassname;
@@ -101,7 +101,7 @@ export const EuiPageHeader: FunctionComponent = ({
tabsProps={tabsProps}
description={description}
rightSideItems={rightSideItems}
- rightSideResponsive={rightSideResponsive}>
+ rightSideGroupProps={rightSideGroupProps}>
{children}
diff --git a/src/components/page/page_header/page_header_content.test.tsx b/src/components/page/page_header/page_header_content.test.tsx
index 92ba2224017b..d704dd2af063 100644
--- a/src/components/page/page_header/page_header_content.test.tsx
+++ b/src/components/page/page_header/page_header_content.test.tsx
@@ -127,11 +127,11 @@ describe('EuiPageHeaderContent', () => {
expect(component).toMatchSnapshot();
});
- test('is rendered with rightSideResponsive as true', () => {
+ test('is rendered with rightSideGroupProps', () => {
const component = render(
);
diff --git a/src/components/page/page_header/page_header_content.tsx b/src/components/page/page_header/page_header_content.tsx
index 293232130580..65caa5ab87b6 100644
--- a/src/components/page/page_header/page_header_content.tsx
+++ b/src/components/page/page_header/page_header_content.tsx
@@ -22,12 +22,12 @@ import classNames from 'classnames';
import { CommonProps } from '../../common';
import { EuiIcon, EuiIconProps, IconType } from '../../icon';
import { EuiTab, EuiTabs, EuiTabsProps } from '../../tabs';
-import { EuiFlexGroup, EuiFlexItem } from '../../flex';
+import { Props as EuiTabProps } from '../../tabs/tab';
+import { EuiFlexGroup, EuiFlexItem, EuiFlexGroupProps } from '../../flex';
import { EuiSpacer } from '../../spacer';
import { EuiTitle } from '../../title';
import { EuiText } from '../../text';
import { useIsWithinBreakpoints } from '../../../services/hooks';
-import { Props as EuiTabProps } from '../../../components/tabs/tab';
export const ALIGN_ITEMS = ['top', 'bottom', 'center', 'stretch'] as const;
@@ -91,6 +91,11 @@ export type EuiPageHeaderContentProps = CommonProps &
* Set to `reverse` to display the right side content first for the sack of hierarchy (like global time)
*/
responsive?: boolean | 'reverse';
+ /**
+ * Vertical alignment of the left and right side content;
+ * Default is `middle` for custom content, but `top` for when `pageTitle` or `tabs` are included
+ */
+ alignItems?: typeof ALIGN_ITEMS[number];
/**
* Pass custom an array of content to this side usually up to 3 buttons.
* The first button should be primary, usually with `fill` and will be visually displayed as the last item,
@@ -98,14 +103,9 @@ export type EuiPageHeaderContentProps = CommonProps &
*/
rightSideItems?: ReactNode[];
/**
- * Vertical alignment of the left and right side content;
- * Default is `middle` for custom content, but `top` for when `pageTitle` or `tabs` are included
- */
- alignItems?: typeof ALIGN_ITEMS[number];
- /**
- * Whether the array of right side items should all break to their own line on small screens
+ * Additional EuiFlexGroup props to pass to the container of the `rightSideItems`
*/
- rightSideResponsive?: boolean;
+ rightSideGroupProps?: Partial;
/**
* Custom children will be rendered before the `tabs` unless no `pageTitle` is present, then it will be the last item
*/
@@ -120,10 +120,10 @@ export const EuiPageHeaderContent: FunctionComponent
tabs,
tabsProps,
description,
- rightSideItems,
alignItems = 'top',
responsive = true,
- rightSideResponsive = false,
+ rightSideItems,
+ rightSideGroupProps,
children,
...rest
}) => {
@@ -246,9 +246,13 @@ export const EuiPageHeaderContent: FunctionComponent
rightSideFlexItem = (
+ responsive={false}
+ {...rightSideGroupProps}
+ className={classNames(
+ 'euiPageHeaderContent__rightSideItems',
+ rightSideGroupProps?.className
+ )}>
{wrapWithFlex()}
From 7d557fcf5b0d1d6d31f18dbe27b1fb5415ab1a81 Mon Sep 17 00:00:00 2001
From: Caroline Horn <549577+cchaos@users.noreply.github.com>
Date: Wed, 10 Feb 2021 13:14:28 -0500
Subject: [PATCH 26/27] Apply suggestions from code review
Co-authored-by: Greg Thompson
---
src/components/page/page_header/page_header_content.tsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/components/page/page_header/page_header_content.tsx b/src/components/page/page_header/page_header_content.tsx
index 65caa5ab87b6..a82df74d0bf6 100644
--- a/src/components/page/page_header/page_header_content.tsx
+++ b/src/components/page/page_header/page_header_content.tsx
@@ -52,7 +52,7 @@ export type EuiPageHeaderContentTitle = {
/**
* Additional EuiIcon props to apply to the optional icon
*/
- iconProps?: Partial;
+ iconProps?: Partial>;
};
export type EuiPageHeaderContentTabs = {
From e97d3b8318b70558ec8622c34957dde6907626a0 Mon Sep 17 00:00:00 2001
From: cchaos
Date: Wed, 10 Feb 2021 13:40:39 -0500
Subject: [PATCH 27/27] Set deprecation notice for `panelPaddingSize`
---
src/components/page/page_content/page_content.tsx | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/components/page/page_content/page_content.tsx b/src/components/page/page_content/page_content.tsx
index cefc78a27537..9169f6fc65b4 100644
--- a/src/components/page/page_content/page_content.tsx
+++ b/src/components/page/page_content/page_content.tsx
@@ -40,6 +40,9 @@ const horizontalPositionToClassNameMap: {
export type EuiPageContentProps = CommonProps &
EuiPanelProps & {
+ /**
+ * **DEPRECATED: use `paddingSize` instead.**
+ */
panelPaddingSize?: PanelPaddingSize;
verticalPosition?: EuiPageContentVerticalPositions;
horizontalPosition?: EuiPageContentHorizontalPositions;