mirror of
https://github.com/supabase/supabase.git
synced 2026-10-12 04:45:08 +03:00
Update Button.tsx
This commit is contained in:
1 parent
142f256641
commit
ecd47f67c3
1 file changed
+18
-5
@@ -148,15 +148,28 @@ export interface ButtonProps
|
||||
}
|
||||
|
||||
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
||||
({ asChild = false, size = 'tiny', type = 'primary', children, ...props }, ref) => {
|
||||
(
|
||||
{
|
||||
asChild = false,
|
||||
size = 'tiny',
|
||||
type = 'primary',
|
||||
children,
|
||||
loading,
|
||||
block,
|
||||
icon,
|
||||
iconRight,
|
||||
iconLeft,
|
||||
...props
|
||||
},
|
||||
ref
|
||||
) => {
|
||||
const Comp = asChild ? Slot : 'button'
|
||||
|
||||
const { className, disabled, loading, icon, iconLeft, iconRight, block } = props
|
||||
|
||||
const { className, disabled } = props
|
||||
const showIcon = loading || icon
|
||||
|
||||
// decrecating 'showIcon' for rightIcon
|
||||
const _iconLeft: React.ReactNode = icon ?? iconLeft
|
||||
// if loading, button is disabled
|
||||
props.disabled = loading ? true : props.disabled
|
||||
|
||||
return (
|
||||
<Comp
|
||||
|
||||
Reference in new issue
Block a user