mirror of
https://github.com/supabase/supabase.git
synced 2026-10-08 10:55:06 +03:00
## Problem Our `<Button>` component breaks the default `button` contract by redefining the `type` prop to set its variant (`primary`, `default`, etc) instead of the button type (`submit`, `button`, etc). This is confusing and forces to write more code when using it with shadcn components that expect/inject the standard button props. ## Solution - rename the `type` prop to `variant` - rename the `htmlType` prop to `type` - propagate the changes where necessary - format code ## How to test As this is just prop renaming, if it builds it's ok --------- Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
52 lines
1.7 KiB
TypeScript
52 lines
1.7 KiB
TypeScript
'use client'
|
|
|
|
import { Info } from 'lucide-react'
|
|
import { Button, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from 'ui'
|
|
|
|
export default function CopyTooltips() {
|
|
return (
|
|
<div className="flex flex-row gap-20">
|
|
<div className="flex flex-col gap-4">
|
|
<span className="text-xs text-foreground-muted">Bad Example</span>
|
|
<div className="flex flex-row gap-8 items-center">
|
|
<TooltipProvider>
|
|
<Tooltip>
|
|
<TooltipTrigger asChild>
|
|
<Button
|
|
variant="text"
|
|
className="flex items-center px-1.5"
|
|
icon={<Info size={20} strokeWidth={1.5} />}
|
|
aria-label="More info"
|
|
/>
|
|
</TooltipTrigger>
|
|
<TooltipContent>
|
|
<p>This is a toggle switch</p>
|
|
</TooltipContent>
|
|
</Tooltip>
|
|
</TooltipProvider>
|
|
</div>
|
|
</div>
|
|
<div className="flex flex-col gap-4">
|
|
<span className="text-xs text-foreground-muted">Good Example</span>
|
|
<div className="flex flex-row gap-8 items-center">
|
|
<TooltipProvider>
|
|
<Tooltip>
|
|
<TooltipTrigger asChild>
|
|
<Button
|
|
variant="text"
|
|
className="flex items-center px-1.5"
|
|
icon={<Info size={20} strokeWidth={1.5} />}
|
|
aria-label="More info"
|
|
/>
|
|
</TooltipTrigger>
|
|
<TooltipContent>
|
|
<p>Restricts access based on user policies</p>
|
|
</TooltipContent>
|
|
</Tooltip>
|
|
</TooltipProvider>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|