mirror of
https://github.com/supabase/supabase.git
synced 2026-12-06 08:29:01 +00: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>
38 lines
1.5 KiB
TypeScript
38 lines
1.5 KiB
TypeScript
import { Button, Input, Label, Popover, PopoverContent, PopoverTrigger } from 'ui'
|
|
|
|
export default function PopoverDemo() {
|
|
return (
|
|
<Popover>
|
|
<PopoverTrigger asChild>
|
|
<Button variant="outline">Open popover</Button>
|
|
</PopoverTrigger>
|
|
<PopoverContent className="w-80">
|
|
<div className="grid gap-4">
|
|
<div className="space-y-2">
|
|
<h4 className="font-medium leading-none">Dimensions</h4>
|
|
<p className="text-sm text-muted-foreground">Set the dimensions for the layer.</p>
|
|
</div>
|
|
<div className="grid gap-2">
|
|
<div className="grid grid-cols-3 items-center gap-4">
|
|
<Label htmlFor="width">Width</Label>
|
|
<Input id="width" defaultValue="100%" className="col-span-2 h-8" />
|
|
</div>
|
|
<div className="grid grid-cols-3 items-center gap-4">
|
|
<Label htmlFor="maxWidth">Max. width</Label>
|
|
<Input id="maxWidth" defaultValue="300px" className="col-span-2 h-8" />
|
|
</div>
|
|
<div className="grid grid-cols-3 items-center gap-4">
|
|
<Label htmlFor="height">Height</Label>
|
|
<Input id="height" defaultValue="25px" className="col-span-2 h-8" />
|
|
</div>
|
|
<div className="grid grid-cols-3 items-center gap-4">
|
|
<Label htmlFor="maxHeight">Max. height</Label>
|
|
<Input id="maxHeight" defaultValue="none" className="col-span-2 h-8" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</PopoverContent>
|
|
</Popover>
|
|
)
|
|
}
|