1
1
import { Link , LinkProps , NavLink , NavLinkProps } from "@remix-run/react" ;
2
- import React , { forwardRef , useImperativeHandle , useRef } from "react" ;
2
+ import React , { forwardRef , ReactNode , useImperativeHandle , useRef } from "react" ;
3
3
import { ShortcutDefinition , useShortcutKeys } from "~/hooks/useShortcutKeys" ;
4
4
import { cn } from "~/utils/cn" ;
5
5
import { IconNamesOrString , NamedIcon } from "./NamedIcon" ;
@@ -173,10 +173,9 @@ export type ButtonContentPropsType = {
173
173
textAlignLeft ?: boolean ;
174
174
className ?: string ;
175
175
shortcut ?: ShortcutDefinition ;
176
- showTooltip ?: boolean ;
177
176
variant : keyof typeof variant ;
178
177
shortcutPosition ?: "before-trailing-icon" | "after-trailing-icon" ;
179
- tooltipDescription ?: string ;
178
+ tooltip ?: ReactNode ;
180
179
iconSpacing ?: string ;
181
180
} ;
182
181
@@ -191,8 +190,7 @@ export function ButtonContent(props: ButtonContentPropsType) {
191
190
fullWidth,
192
191
textAlignLeft,
193
192
className,
194
- showTooltip,
195
- tooltipDescription,
193
+ tooltip,
196
194
iconSpacing,
197
195
} = props ;
198
196
const variation = allVariants . variant [ props . variant ] ;
@@ -254,7 +252,7 @@ export function ButtonContent(props: ButtonContentPropsType) {
254
252
) ) }
255
253
256
254
{ shortcut &&
257
- ! showTooltip &&
255
+ ! tooltip &&
258
256
props . shortcutPosition === "before-trailing-icon" &&
259
257
renderShortcutKey ( ) }
260
258
@@ -281,20 +279,20 @@ export function ButtonContent(props: ButtonContentPropsType) {
281
279
) ) }
282
280
283
281
{ shortcut &&
284
- ! showTooltip &&
282
+ ! tooltip &&
285
283
( ! props . shortcutPosition || props . shortcutPosition === "after-trailing-icon" ) &&
286
284
renderShortcutKey ( ) }
287
285
</ div >
288
286
</ div >
289
287
) ;
290
288
291
- if ( shortcut && showTooltip ) {
289
+ if ( tooltip ) {
292
290
return (
293
291
< TooltipProvider >
294
292
< Tooltip >
295
293
< TooltipTrigger asChild > { buttonContent } </ TooltipTrigger >
296
294
< TooltipContent className = "text-dimmed flex items-center gap-3 py-1.5 pl-2.5 pr-3 text-xs" >
297
- { tooltipDescription } { renderShortcutKey ( ) }
295
+ { tooltip } { shortcut && renderShortcutKey ( ) }
298
296
</ TooltipContent >
299
297
</ Tooltip >
300
298
</ TooltipProvider >
0 commit comments