Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #6165: TabView refactor closeIcon like other icons #6166

Merged
merged 1 commit into from
Mar 25, 2024
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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