Skip to content
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
1 change: 0 additions & 1 deletion src-docs/src/views/page/page_bottom_bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ export default ({ button = <></>, content, sideNav, bottomBar }) => {
<OuiPageHeader
bottomBorder
restrictWidth
iconType="logoOpenSearch"
pageTitle="Page title"
rightSideItems={[button]}
/>
Expand Down
1 change: 0 additions & 1 deletion src-docs/src/views/page/page_centered_content.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ export default ({ button = <></>, content, sideNav }) => (
<OuiPageBody panelled>
<OuiPageHeader
restrictWidth
iconType="logoOpenSearch"
pageTitle="Page title"
rightSideItems={[button]}
/>
Expand Down
1 change: 0 additions & 1 deletion src-docs/src/views/page/page_custom_content.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ export default ({ button = <></> }) => (
<OuiPage paddingSize="l">
<OuiPageBody>
<OuiPageHeader
iconType="logoOpenSearch"
pageTitle="Page title"
rightSideItems={[button, <OuiButton>Do something</OuiButton>]}
bottomBorder
Expand Down
1 change: 0 additions & 1 deletion src-docs/src/views/page/page_new.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ export default ({ button = <></>, content, sideNav }) => (
<OuiPageBody panelled>
<OuiPageHeader
restrictWidth
iconType="logoOpenSearch"
pageTitle="Page title"
rightSideItems={[button]}
tabs={[{ label: 'Tab 1', isSelected: true }, { label: 'Tab 2' }]}
Expand Down
1 change: 0 additions & 1 deletion src-docs/src/views/page/page_restricting_width.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export default ({ button = <></>, content, sideNav }) => {
<OuiPageBody panelled>
<OuiPageHeader
restrictWidth={'75%'}
iconType="logoOpenSearch"
pageTitle="Page title"
rightSideItems={[button]}
description="Restricting the width to 75%."
Expand Down
1 change: 0 additions & 1 deletion src-docs/src/views/page/page_simple_empty_content.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ export default ({ button = <></>, content }) => (
<OuiPageBody>
<OuiPageHeader
restrictWidth
iconType="logoOpenSearch"
pageTitle="Page title"
rightSideItems={[button]}
paddingSize="l"
Expand Down
1 change: 0 additions & 1 deletion src-docs/src/views/page_header/page_header.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import {
export default () => (
<OuiPageHeader
pageTitle="Page title"
iconType="logoKibana"
tabs={[
{
label: 'Tab 1',
Expand Down
5 changes: 2 additions & 3 deletions src-docs/src/views/page_header/page_header_example.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,8 @@ export const PageHeaderExample = {
and primary array item will be displayed on the far right.
</p>
<p>
You can further adjust the display of these content types with an
optional <OuiCode>iconType</OuiCode> placed to the left of the
title, <OuiCode>alignItems</OuiCode> for adjusting the vertical
You can further adjust the display of these content types by
utilizing <OuiCode>alignItems</OuiCode> for adjusting the vertical
alignment of the two sides, and <OuiCode>responsiveOrder</OuiCode>{' '}
to determine which content side to display first on smaller screens.
</p>
Expand Down
3 changes: 0 additions & 3 deletions src-docs/src/views/page_header/playground.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import {
} from '../../../../src/components/';
import {
propUtilityForPlayground,
iconValidator,
simulateFunction,
generateCustomProps,
createOptionalEnum,
Expand Down Expand Up @@ -53,8 +52,6 @@ export const pageHeaderConfig = () => {
: OuiPageHeader.__docgenInfo;
const propsToUse = propUtilityForPlayground(docgenInfo.props);

propsToUse.iconType = iconValidator(propsToUse.iconType);

propsToUse.pageTitle = {
...propsToUse.pageTitle,
type: PropTypes.String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,12 +210,6 @@ exports[`OuiPageHeader props page content props are passed down is rendered 1`]
<h1
class="ouiTitle ouiTitle--large"
>
<span
aria-label="aria-label"
class="ouiPageHeaderContent__titleIcon testClass1 testClass2"
data-ouiicon-type="logoKibana"
data-test-subj="test subject string"
/>
Page title
</h1>
<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -354,56 +354,6 @@ exports[`OuiPageHeaderContent props pageTitle is rendered 1`] = `
</div>
`;

exports[`OuiPageHeaderContent props pageTitle is rendered with icon 1`] = `
<div
class="ouiPageHeaderContent"
>
<div
class="ouiFlexGroup ouiFlexGroup--gutterLarge ouiFlexGroup--alignItemsFlexStart ouiFlexGroup--directionRow ouiFlexGroup--responsive ouiPageHeaderContent__top"
>
<div
class="ouiFlexItem"
>
<h1
class="ouiTitle ouiTitle--large"
>
<span
class="ouiPageHeaderContent__titleIcon"
data-ouiicon-type="logoKibana"
/>
Page title
</h1>
</div>
</div>
</div>
`;

exports[`OuiPageHeaderContent props pageTitle is rendered with icon and iconProps 1`] = `
<div
class="ouiPageHeaderContent"
>
<div
class="ouiFlexGroup ouiFlexGroup--gutterLarge ouiFlexGroup--alignItemsFlexStart ouiFlexGroup--directionRow ouiFlexGroup--responsive ouiPageHeaderContent__top"
>
<div
class="ouiFlexItem"
>
<h1
class="ouiTitle ouiTitle--large"
>
<span
aria-label="aria-label"
class="ouiPageHeaderContent__titleIcon testClass1 testClass2"
data-ouiicon-type="logoKibana"
data-test-subj="test subject string"
/>
Page title
</h1>
</div>
</div>
</div>
`;

exports[`OuiPageHeaderContent props responsive is rendered as false 1`] = `
<div
class="ouiPageHeaderContent"
Expand Down
6 changes: 0 additions & 6 deletions src/components/page/page_header/_page_header_content.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,6 @@
width: 100%;
}

.ouiPageHeaderContent__titleIcon {
top: -$ouiSizeXS;
position: relative;
margin-right: $ouiSize;
}

@include ouiBreakpoint('m', 'l', 'xl') {
.ouiPageHeaderContent__rightSideItems {
flex-direction: row-reverse;
Expand Down
48 changes: 1 addition & 47 deletions src/components/page/page_header/page_header.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
*/

import React from 'react';
import { mount, render } from 'enzyme';
import { render } from 'enzyme';
import { requiredProps } from '../../../test';

import { OuiPageHeader, OuiPageHeaderProps } from './page_header';
Expand Down Expand Up @@ -65,8 +65,6 @@ describe('OuiPageHeader', () => {
const component = render(
<OuiPageHeader
pageTitle="Page title"
iconType="logoKibana"
iconProps={requiredProps}
tabs={tabs}
tabsProps={requiredProps}
description="Description"
Expand Down Expand Up @@ -124,48 +122,4 @@ describe('OuiPageHeader', () => {
});
});
});

describe('deprecation', () => {
it('should console 1 deprecation warning without repetition', () => {
console.warn = jest.fn();

const component = mount(<OuiPageHeader iconType="dashboardApp" />);
component.setProps({ iconType: 'database' });

expect(console.warn).toHaveBeenCalledTimes(1);
expect(console.warn).toHaveBeenCalledWith(
'[DEPRECATED] The `iconType` prop is deprecated and will be removed in v2.0.0.'
);
});

it('should console 2 deprecation warning without repetition', () => {
console.warn = jest.fn();

const component = mount(
<OuiPageHeader iconType="dashboardApp" iconProps={{ color: 'red' }} />
);
component.setProps({
iconType: 'database',
iconProps: { color: 'blue' },
});

const results = [
'[DEPRECATED] The `iconType` prop is deprecated and will be removed in v2.0.0.',
'[DEPRECATED] The `iconProps` prop is deprecated and will be removed in v2.0.0.',
];

expect(console.warn).toHaveBeenCalledTimes(2);
results.forEach((item) =>
expect(console.warn).toHaveBeenCalledWith(item)
);
});

it('should not console deprecation warning', () => {
console.warn = jest.fn();

mount(<OuiPageHeader />);

expect(console.warn).not.toHaveBeenCalled();
});
});
});
10 changes: 0 additions & 10 deletions src/components/page/page_header/page_header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ import {
_OuiPageRestrictWidth,
setPropsForRestrictedPageWidth,
} from '../_restrict_width';
import { useDeprecatedPropWarning } from '../../../utils';

const paddingSizeToClassNameMap = {
none: null,
Expand Down Expand Up @@ -79,8 +78,6 @@ export const OuiPageHeader: FunctionComponent<OuiPageHeaderProps> = ({

// Page header content only props:
pageTitle,
iconType,
iconProps,
tabs,
tabsProps,
description,
Expand All @@ -93,11 +90,6 @@ export const OuiPageHeader: FunctionComponent<OuiPageHeaderProps> = ({
style
);

useDeprecatedPropWarning({
props: { iconType, iconProps },
version: '2.0.0',
});

const classes = classNames(
'ouiPageHeader',
paddingSizeToClassNameMap[paddingSize],
Expand Down Expand Up @@ -126,8 +118,6 @@ export const OuiPageHeader: FunctionComponent<OuiPageHeaderProps> = ({
alignItems={alignItems}
responsive={responsive}
pageTitle={pageTitle}
iconType={iconType}
iconProps={iconProps}
tabs={tabs}
tabsProps={tabsProps}
description={description}
Expand Down
20 changes: 0 additions & 20 deletions src/components/page/page_header/page_header_content.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,26 +69,6 @@ describe('OuiPageHeaderContent', () => {

expect(component).toMatchSnapshot();
});

test('is rendered with icon', () => {
const component = render(
<OuiPageHeaderContent pageTitle="Page title" iconType="logoKibana" />
);

expect(component).toMatchSnapshot();
});

test('is rendered with icon and iconProps', () => {
const component = render(
<OuiPageHeaderContent
pageTitle="Page title"
iconType="logoKibana"
iconProps={requiredProps}
/>
);

expect(component).toMatchSnapshot();
});
});

describe('tabs', () => {
Expand Down
32 changes: 2 additions & 30 deletions src/components/page/page_header/page_header_content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import React, { FunctionComponent, ReactNode, HTMLAttributes } from 'react';
import classNames from 'classnames';
import { CommonProps } from '../../common';
import { OuiIcon, OuiIconProps, IconType } from '../../icon';
import { OuiTab, OuiTabs, OuiTabsProps } from '../../tabs';
import { Props as OuiTabProps } from '../../tabs/tab';
import { OuiFlexGroup, OuiFlexItem, OuiFlexGroupProps } from '../../flex';
Expand All @@ -56,16 +55,6 @@ export type OuiPageHeaderContentTitle = {
* A simple string is best
*/
pageTitle?: ReactNode;
/**
* Optional icon to place to the left of the title
* @deprecated The `iconType` prop is deprecated and will be removed in the future.
*/
iconType?: IconType;
/**
* Additional OuiIcon props to apply to the optional icon
* @deprecated The `iconProps` prop is deprecated and will be removed in the future.
*/
iconProps?: Partial<Omit<OuiIconProps, 'type'>>;
};

export type OuiPageHeaderContentTabs = {
Expand All @@ -83,7 +72,7 @@ export type OuiPageHeaderContentTabs = {
};

/**
* The left side can either be a title with optional description and/or icon;
* The left side can either be a title with optional description;
* Or a list of tabs,
* Or a custom node
*/
Expand Down Expand Up @@ -128,8 +117,6 @@ export type OuiPageHeaderContentProps = CommonProps &
export const OuiPageHeaderContent: FunctionComponent<OuiPageHeaderContentProps> = ({
className,
pageTitle,
iconType,
iconProps,
tabs,
tabsProps,
description,
Expand Down Expand Up @@ -161,24 +148,9 @@ export const OuiPageHeaderContent: FunctionComponent<OuiPageHeaderContentProps>

let pageTitleNode;
if (pageTitle) {
const icon = iconType ? (
<OuiIcon
size="xl"
{...iconProps}
type={iconType}
className={classNames(
'ouiPageHeaderContent__titleIcon',
iconProps?.className
)}
/>
) : undefined;

pageTitleNode = (
<OuiTitle size="l">
<h1>
{icon}
{pageTitle}
</h1>
<h1>{pageTitle}</h1>
</OuiTitle>
);
}
Expand Down