Fixed button layout to have loading the same size as the original button
This commit is contained in:
parent
5b83bde64e
commit
cad4c508a9
1 changed files with 11 additions and 4 deletions
|
|
@ -68,10 +68,17 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
||||||
{...props}
|
{...props}
|
||||||
>
|
>
|
||||||
{loading ? (
|
{loading ? (
|
||||||
<ForwardedIconComponent
|
<span className={cn("relative")}>
|
||||||
name={"Loader2"}
|
<span className={loading ? "invisible" : "hidden"}>
|
||||||
className={"animate-spin"}
|
{newChildren}
|
||||||
/>
|
</span>
|
||||||
|
<span className="absolute inset-0 flex items-center justify-center">
|
||||||
|
<ForwardedIconComponent
|
||||||
|
name={"Loader2"}
|
||||||
|
className={"animate-spin"}
|
||||||
|
/>
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
) : (
|
) : (
|
||||||
newChildren
|
newChildren
|
||||||
)}
|
)}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue