From 71dc4bd5f04603d69143a94c528fb57bc960c7ce Mon Sep 17 00:00:00 2001 From: Sirazh Gabdullin Date: Tue, 16 May 2023 23:03:41 +0600 Subject: [PATCH] Deprecate ```iconType``` and ```iconProps``` from ```OuiPageHeader``` (#759) * Deprecate iconType and iconProps Signed-off-by: Sirazh Gabdullin * Move deprecated doc comment to prop's definition Signed-off-by: Sirazh Gabdullin --------- Signed-off-by: Sirazh Gabdullin --- src/components/page/page_header/page_header.tsx | 10 +++++++++- .../page/page_header/page_header_content.tsx | 2 ++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/components/page/page_header/page_header.tsx b/src/components/page/page_header/page_header.tsx index 52624c4d6d..50cf06ac87 100644 --- a/src/components/page/page_header/page_header.tsx +++ b/src/components/page/page_header/page_header.tsx @@ -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 { @@ -92,6 +92,14 @@ export const OuiPageHeader: FunctionComponent = ({ 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], diff --git a/src/components/page/page_header/page_header_content.tsx b/src/components/page/page_header/page_header_content.tsx index 6fbcb905bd..8677778fdd 100644 --- a/src/components/page/page_header/page_header_content.tsx +++ b/src/components/page/page_header/page_header_content.tsx @@ -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>; };