Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

fix(Button): convert loading spinner overlay from inline styles to StyleX (#742)

Cindy Zhang3113ca2da0c6
diff --git a/packages/core/src/Button/XDSButton.tsx b/packages/core/src/Button/XDSButton.tsx
index 0f48c45a3c..55b79f6efb 100644
--- a/packages/core/src/Button/XDSButton.tsx
+++ b/packages/core/src/Button/XDSButton.tsx
@@ -275,6 +275,16 @@ const loadingStyles = stylex.create({
position: 'relative',
color: 'transparent',
},
+ spinnerOverlay: {
+ position: 'absolute',
+ top: 0,
+ left: 0,
+ right: 0,
+ bottom: 0,
+ display: 'flex',
+ alignItems: 'center',
+ justifyContent: 'center',
+ },
});
/**
@@ -381,17 +391,7 @@ export function XDSButton({
{...props}
onClick={handleClick}>
{isLoadingState && (
- <span
- style={{
- position: 'absolute',
- top: 0,
- left: 0,
- right: 0,
- bottom: 0,
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'center',
- }}>
+ <span {...stylex.props(loadingStyles.spinnerOverlay)}>
<XDSSpinner
size="sm"
shade={useLightSpinner ? 'onMedia' : 'default'}