mirror of
https://github.com/supabase/supabase.git
synced 2026-05-07 17:30:25 -04:00
ea0523ce02
The connect button was missing its text Before: <img width="833" height="244" alt="Screenshot 2026-05-06 at 17 46 23" src="https://github.com/user-attachments/assets/c03e972f-bef6-4bd7-8819-dd51509c58eb" /> After: <img width="678" height="208" alt="Screenshot 2026-05-06 at 17 46 58" src="https://github.com/user-attachments/assets/5b020017-133e-47c3-8138-925c27299665" /> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved screen reader accessibility in the Connect button by refining how text visibility is handled based on button display mode. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
29 lines
881 B
TypeScript
29 lines
881 B
TypeScript
import { ComponentProps, ComponentPropsWithoutRef, ElementRef, forwardRef, ReactNode } from 'react'
|
|
import { Button, cn, Tooltip, TooltipContent, TooltipTrigger } from 'ui'
|
|
|
|
export const ButtonTooltip = forwardRef<
|
|
ElementRef<typeof Button>,
|
|
ComponentPropsWithoutRef<typeof Button> & {
|
|
tooltip: {
|
|
content: ComponentProps<typeof TooltipContent> & {
|
|
text?: string | ReactNode
|
|
}
|
|
}
|
|
}
|
|
>(({ tooltip, className, ...props }, ref) => {
|
|
return (
|
|
<Tooltip>
|
|
<TooltipTrigger asChild>
|
|
<Button ref={ref} {...props} className={cn(className, 'pointer-events-auto')}>
|
|
{props.children}
|
|
</Button>
|
|
</TooltipTrigger>
|
|
{tooltip.content.text !== undefined && (
|
|
<TooltipContent {...tooltip.content}>{tooltip.content.text}</TooltipContent>
|
|
)}
|
|
</Tooltip>
|
|
)
|
|
})
|
|
|
|
ButtonTooltip.displayName = 'ButtonTooltip'
|