Skip to content

Commit

Permalink
Fix #6165: TabView refactor closeIcon like other icons (#6166)
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware authored Mar 25, 2024
1 parent d372c68 commit 6a9159f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
12 changes: 9 additions & 3 deletions components/lib/tabview/TabView.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,9 +338,15 @@ export const TabView = React.forwardRef((inProps, ref) => {
);
const titleElement = <span {...headerTitleProps}>{header}</span>;
const rightIconElement = rightIcon && IconUtils.getJSXIcon(rightIcon, undefined, { props });
const iconClassName = 'p-tabview-close';
const icon = closeIcon || <TimesIcon className={iconClassName} onClick={(e) => 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 || <TimesIcon {...closeIconProps} />;
const closableIconElement = closable ? IconUtils.getJSXIcon(icon, { ...closeIconProps }, { props }) : null;

const headerActionProps = mergeProps(
{
Expand Down
1 change: 1 addition & 0 deletions components/lib/tabview/TabViewBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 6a9159f

Please sign in to comment.