Skip to content

Commit

Permalink
chore: hide start icon when loading
Browse files Browse the repository at this point in the history
  • Loading branch information
benjitrosch committed Mar 16, 2022
1 parent f3046d0 commit 5918a11
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ const Button = forwardRef<HTMLButtonElement, ButtonProps>(
const classes = twMerge(
'btn',
className,
clsx((startIcon || endIcon) && 'gap-2', {
clsx(
((startIcon && !loading) || endIcon) && 'gap-2',
{
[`btn-${size}`]: size,
[`btn-${shape}`]: shape,
[`btn-${variant}`]: variant,
Expand Down Expand Up @@ -87,7 +89,7 @@ const Button = forwardRef<HTMLButtonElement, ButtonProps>(
style={style}
disabled={disabled}
>
{startIcon && startIcon}
{startIcon && !loading && startIcon}
{children}
{endIcon && endIcon}
</button>
Expand Down

0 comments on commit 5918a11

Please sign in to comment.