From 16a2c7a2ff16cd743faecfa6408b797836783964 Mon Sep 17 00:00:00 2001 From: melloware Date: Sat, 16 Mar 2024 07:42:44 -0400 Subject: [PATCH] Fix #6165: TabView refactor closeIcon like other icons --- components/lib/tabview/TabView.js | 12 +++++++++--- components/lib/tabview/TabViewBase.js | 1 + 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/components/lib/tabview/TabView.js b/components/lib/tabview/TabView.js index c491279982..4c85768050 100644 --- a/components/lib/tabview/TabView.js +++ b/components/lib/tabview/TabView.js @@ -338,9 +338,15 @@ export const TabView = React.forwardRef((inProps, ref) => { ); const titleElement = {header}; const rightIconElement = rightIcon && IconUtils.getJSXIcon(rightIcon, undefined, { props }); - const iconClassName = 'p-tabview-close'; - const icon = closeIcon || onTabHeaderClose(e, index)} />; - const closableIconElement = closable ? IconUtils.getJSXIcon(icon, { className: iconClassName, onClick: (e) => onTabHeaderClose(e, index) }, { props }) : null; + const closeIconProps = mergeProps( + { + className: cx('tab.closeIcon'), + onClick: (e) => onTabHeaderClose(e, index) + }, + getTabPT(tab, 'closeIcon', index) + ); + const icon = closeIcon || ; + const closableIconElement = closable ? IconUtils.getJSXIcon(icon, { ...closeIconProps }, { props }) : null; const headerActionProps = mergeProps( { diff --git a/components/lib/tabview/TabViewBase.js b/components/lib/tabview/TabViewBase.js index e6a4bbc89c..b658ed6306 100644 --- a/components/lib/tabview/TabViewBase.js +++ b/components/lib/tabview/TabViewBase.js @@ -21,6 +21,7 @@ const classes = { header: ({ selected, disabled, headerClassName, _className }) => classNames('p-unselectable-text', { 'p-tabview-selected p-highlight': selected, 'p-disabled': disabled }, headerClassName, _className), headertitle: 'p-tabview-title', headeraction: 'p-tabview-nav-link', + closeIcon: 'p-tabview-close', content: ({ props, selected, getTabProp, tab, isSelected, shouldUseTab, index }) => shouldUseTab(tab, index) && (!props.renderActiveOnly || isSelected(index)) ? classNames(getTabProp(tab, 'contentClassName'), getTabProp(tab, 'className'), 'p-tabview-panel', { 'p-hidden': !selected }) : undefined }