Skip to content

Commit 2cc4b71

Browse files
fix: Polish button loading state and spinner sizing
- Updated `Button.tsx` to pass dynamic size to `Spinner` based on the button size (sm=16, md=20, lg=24). - Ensures the spinner is proportional to the button text.
1 parent 13fec4e commit 2cc4b71

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

web/components/ui/Button.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ export const Button: React.FC<ButtonProps> = ({
2727
lg: "px-6 py-3 text-lg"
2828
};
2929

30+
const spinnerSizes = {
31+
sm: 16,
32+
md: 20,
33+
lg: 24
34+
};
35+
3036
let themeStyles = "";
3137

3238
if (style === THEMES.NEOBRUTALISM) {
@@ -53,7 +59,7 @@ export const Button: React.FC<ButtonProps> = ({
5359
disabled={isLoading || props.disabled}
5460
{...props}
5561
>
56-
{isLoading && <Spinner className="mr-1" />}
62+
{isLoading && <Spinner className="mr-1" size={spinnerSizes[size]} />}
5763
{children}
5864
</button>
5965
);

0 commit comments

Comments
 (0)