Skip to content

Commit baa6183

Browse files
committed
chore: hide-custom-icon-when-loading-in-button
1 parent 350b14f commit baa6183

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

src/lib/button/ButtonIcon.tsx

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,19 @@ const ButtonIcon: React.FC<
66
Pick<ButtonProps, "Icon" | "icon" | "isDisabled" | "isLoading" | "variant">
77
> = ({ Icon, icon, isDisabled, isLoading, variant }) => {
88
const isSecondary = variant === "secondary";
9-
return (
10-
icon ??
11-
(Icon && (
12-
<Icon
13-
className={cn(
14-
"button-svg",
15-
"mr-2 size-4",
16-
"fill-klerosUIComponentsWhiteBackground",
17-
isLoading && ["invisible"],
18-
isSecondary && ["fill-klerosUIComponentsPrimaryBlue"],
19-
isDisabled && ["fill-klerosUIComponentsStroke"],
20-
)}
21-
/>
22-
))
23-
);
9+
return icon
10+
? !isLoading && icon
11+
: Icon && (
12+
<Icon
13+
className={cn(
14+
"button-svg",
15+
"mr-2 size-4",
16+
"fill-klerosUIComponentsWhiteBackground",
17+
isLoading && ["invisible"],
18+
isSecondary && ["fill-klerosUIComponentsPrimaryBlue"],
19+
isDisabled && ["fill-klerosUIComponentsStroke"],
20+
)}
21+
/>
22+
);
2423
};
2524
export default ButtonIcon;

0 commit comments

Comments
 (0)