Skip to content

Commit

Permalink
fix(SidePanel): apply tooltip props conditionally
Browse files Browse the repository at this point in the history
@matthewgallo’s changes from #4654
  • Loading branch information
elycheea committed Apr 26, 2024
1 parent ec9ac16 commit e64c272
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -522,11 +522,13 @@ WithActionToolbar.args = {
label: 'Settings',
icon: (props) => <Settings size={16} {...props} />,
onClick: action('Toolbar button clicked: Settings'),
hasIconOnly: true,
},
{
label: 'Delete',
icon: (props) => <TrashCan size={16} {...props} />,
onClick: action('Toolbar button clicked: Delete'),
hasIconOnly: true,
},
],
...defaultStoryProps,
Expand Down
12 changes: 8 additions & 4 deletions packages/ibm-products/src/components/SidePanel/SidePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,9 @@ export let SidePanel = React.forwardRef(
({
label,
kind,
hasIconOnly = false,
icon,
renderIcon,
tooltipPosition,
tooltipAlignment,
leading,
Expand All @@ -753,11 +755,13 @@ export let SidePanel = React.forwardRef(
key={label}
kind={kind || 'ghost'}
size="sm"
renderIcon={icon}
renderIcon={renderIcon || icon}
iconDescription={label}
tooltipPosition={tooltipPosition || 'bottom'}
tooltipAlignment={tooltipAlignment || 'start'}
hasIconOnly={!leading}
{...(hasIconOnly && {
tooltipPosition: tooltipPosition || 'bottom',
tooltipAlignment: tooltipAlignment || 'start',
})}
hasIconOnly={hasIconOnly}
disabled={disabled}
className={cx([
`${blockClass}__action-toolbar-button`,
Expand Down

0 comments on commit e64c272

Please sign in to comment.