Skip to content

Commit

Permalink
fix(core): broken Slot functionality in Button (#919)
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgemoya committed May 17, 2024
1 parent ff231c9 commit cde181e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/small-eagles-switch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@bigcommerce/catalyst-core": patch
---

Fix broken Slot functionality in Button
16 changes: 10 additions & 6 deletions core/components/ui/button/button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,17 @@ export const Button = forwardRef<ElementRef<'button'>, ButtonProps>(
ref={ref}
{...props}
>
{loading && (
<span className="absolute z-10 flex h-full w-full items-center justify-center">
<Spinner aria-hidden="true" className="animate-spin" />
<span className="sr-only">{loadingText}</span>
</span>
{loading ? (
<>
<span className="absolute z-10 flex h-full w-full items-center justify-center">
<Spinner aria-hidden="true" className="animate-spin" />
<span className="sr-only">{loadingText}</span>
</span>
<span className={cn('invisible flex items-center')}>{children}</span>
</>
) : (
children
)}
<span className={cn('flex items-center', loading && 'invisible')}>{children}</span>
</Comp>
);
},
Expand Down

0 comments on commit cde181e

Please sign in to comment.