Skip to content

Commit

Permalink
Deprecate iconType and iconProps from OuiPageHeader (
Browse files Browse the repository at this point in the history
…opensearch-project#759)

* Deprecate iconType and iconProps

Signed-off-by: Sirazh Gabdullin <[email protected]>

* Move deprecated doc comment to prop's definition

Signed-off-by: Sirazh Gabdullin <[email protected]>

---------

Signed-off-by: Sirazh Gabdullin <[email protected]>
  • Loading branch information
curq authored May 16, 2023
1 parent e8b5af9 commit 71dc4bd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/components/page/page_header/page_header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* under the License.
*/

import React, { FunctionComponent, HTMLAttributes } from 'react';
import React, { FunctionComponent, HTMLAttributes, useEffect } from 'react';
import classNames from 'classnames';
import { CommonProps, keysOf } from '../../common';
import {
Expand Down Expand Up @@ -92,6 +92,14 @@ export const OuiPageHeader: FunctionComponent<OuiPageHeaderProps> = ({
style
);

useEffect(() => {
if (iconType || iconProps) {
console.warn(
'WARNING: The `iconType` and `iconProps` properties in `OuiPageHeader` are deprecated and will be removed in the future. Please update your code accordingly.'
);
}
}, [iconType, iconProps]);

const classes = classNames(
'ouiPageHeader',
paddingSizeToClassNameMap[paddingSize],
Expand Down
2 changes: 2 additions & 0 deletions src/components/page/page_header/page_header_content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,12 @@ export type OuiPageHeaderContentTitle = {
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'>>;
};
Expand Down

0 comments on commit 71dc4bd

Please sign in to comment.