Skip to content

Commit 69fab6d

Browse files
committed
refactor: update typing for tooltip
1 parent c7ec43b commit 69fab6d

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/Shared/Components/Button/Button.component.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,16 +66,16 @@ const Button = ({
6666
endIcon = null,
6767
disabled = false,
6868
isLoading = false,
69-
showTippy = false,
70-
tippyContent = null,
69+
showTooltip = false,
70+
tooltipProps = {},
7171
type = 'button',
7272
...props
7373
}: ButtonProps) => {
7474
const isDisabled = disabled || isLoading
7575
const iconClass = `dc__no-shrink flex dc__fill-available-space ${BUTTON_SIZE_TO_ICON_CLASS_NAME_MAP[size]}`
7676

7777
return (
78-
<Tooltip content={tippyContent} alwaysShowTippyOnHover={showTippy && !!tippyContent}>
78+
<Tooltip {...tooltipProps} alwaysShowTippyOnHover={showTooltip && !!tooltipProps?.content}>
7979
<div>
8080
<button
8181
{...props}

src/Shared/Components/Button/types.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,16 +57,16 @@ export type ButtonProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'childre
5757
} & (
5858
| {
5959
/**
60-
* If true, the tippy is shown for the button
60+
* If true, the tooltip is shown for the button
6161
*/
62-
showTippy: boolean
62+
showTooltip: boolean
6363
/**
64-
* Tippy content to be shown for use cases like disabled etc
64+
* Props for tooltip
6565
*/
66-
tippyContent: TooltipProps['content']
66+
tooltipProps: Omit<TooltipProps, 'alwaysShowTippyOnHover' | 'showOnTruncate'>
6767
}
6868
| {
69-
showTippy?: never
70-
tippyContent?: never
69+
showTooltip?: never
70+
tooltipProps?: never
7171
}
7272
)

0 commit comments

Comments
 (0)