Skip to content

Commit 332a72d

Browse files
committed
Update loading gradient styles in light and dark theme token files for consistency and improved readability
1 parent 22469b1 commit 332a72d

File tree

4 files changed

+22
-23
lines changed

4 files changed

+22
-23
lines changed

src/components/Button/Button.tsx

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -119,13 +119,6 @@ const StyledButton = styled(BaseButton)<{
119119
pointer-events: none;
120120
background-size: ${({ $fillWidth }) => ($fillWidth ? "200% 100%" : "200px 100%")};
121121
opacity: 0;
122-
z-index: 0;
123-
}
124-
125-
/* Ensure content stays above shimmer */
126-
> * {
127-
position: relative;
128-
z-index: 1;
129122
}
130123
131124
${({ $loading, $fillWidth, $styleType, theme }) => {
@@ -134,11 +127,13 @@ const StyledButton = styled(BaseButton)<{
134127
const shimmerGradient = theme.click.button.basic.color[$styleType].background.loading;
135128
const bgSize = $fillWidth ? "200% 100%" : "200px 100%";
136129
const shimmerAnimation = $fillWidth ? shimmerFullWidth : shimmerFixedWidth;
130+
const bgRepeat = $fillWidth ? "repeat" : "no-repeat";
137131
138132
return css`
139133
&::before {
140134
background: ${shimmerGradient};
141135
background-size: ${bgSize};
136+
background-repeat: ${bgRepeat};
142137
animation: ${shimmerAnimation} 1.5s ease-in-out infinite;
143138
opacity: 1;
144139
}
@@ -190,15 +185,19 @@ const StyledButton = styled(BaseButton)<{
190185
}}
191186
192187
/* Loading state styling */
193-
${({ $loading }) => {
188+
${({ $loading, $styleType }) => {
194189
if (!$loading) return "";
195190
191+
const isPrimary = $styleType === "primary";
192+
const textOpacity = isPrimary ? 0.8 : 0.7;
193+
196194
return css`
197195
cursor: not-allowed;
196+
${isPrimary ? "opacity: 0.6;" : ""}
198197
199-
/* Dim text and icons to 70% */
198+
/* Dim text and icons */
200199
> * {
201-
opacity: 0.7;
200+
opacity: ${textOpacity};
202201
}
203202
`;
204203
}}

src/theme/tokens/variables.dark.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@
173173
"hover": "rgb(98.6% 100% 58.8%)",
174174
"active": "rgb(90.7% 92.5% 38.1%)",
175175
"disabled": "#414141",
176-
"loading": "linear-gradient(\n 90deg,\n rgba(250, 255, 105, 0.8) 0%,\n rgba(255, 255, 255, 0.5) 50%,\n rgba(250, 255, 105, 0.8) 100%\n)"
176+
"loading": "linear-gradient(90deg, rgb(230, 240, 93) 0%, rgba(255, 255, 255, 0.3) 50%, rgb(230, 240, 93) 100%)"
177177
},
178178
"stroke": {
179179
"default": "#FAFF69",
@@ -194,7 +194,7 @@
194194
"hover": "#282828",
195195
"active": "rgb(19.9% 19.9% 19.9%)",
196196
"disabled": "#414141",
197-
"loading": "linear-gradient(\n 90deg,\n rgb(31, 31, 28) 0%,\n rgba(255, 255, 255, 0.2) 50%,\n rgb(31, 31, 28) 100%\n)"
197+
"loading": "linear-gradient(90deg, rgb(31, 31, 28) 0%, rgba(255, 255, 255, 0.2) 50%, rgb(31, 31, 28) 100%)"
198198
},
199199
"stroke": {
200200
"default": "#414141",
@@ -221,7 +221,7 @@
221221
"hover": "rgb(100% 13.7% 13.7% / 0.3)",
222222
"active": "rgb(100% 13.7% 13.7% / 0.45)",
223223
"disabled": "#414141",
224-
"loading": "linear-gradient(\n 90deg,\n rgb(76, 32, 29) 0%,\n rgba(255, 255, 255, 0.25) 50%,\n rgb(76, 32, 29) 100%\n)"
224+
"loading": "linear-gradient(90deg, rgb(76, 32, 29) 0%, rgba(255, 255, 255, 0.25) 50%, rgb(76, 32, 29) 100%)"
225225
},
226226
"stroke": {
227227
"default": "rgb(100% 22.3% 22.3% / 0.1)",
@@ -242,7 +242,7 @@
242242
"hover": "#282828",
243243
"active": "rgba(0,0,0,0)",
244244
"disabled": "rgba(0,0,0,0)",
245-
"loading": "linear-gradient(\n 90deg,\n rgba(250, 255, 105, 0.1) 0%,\n rgba(250, 255, 105, 0.3) 50%,\n rgba(250, 255, 105, 0.1) 100%\n)"
245+
"loading": "linear-gradient(90deg, rgba(250, 255, 105, 0.1) 0%, rgba(250, 255, 105, 0.3) 50%, rgba(250, 255, 105, 0.1) 100%)"
246246
},
247247
"stroke": {
248248
"default": "rgba(0,0,0,0)",
@@ -1889,4 +1889,4 @@
18891889
}
18901890
},
18911891
"name": "dark"
1892-
}
1892+
}

src/theme/tokens/variables.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@
399399
"hover": "lch(29.5 4.18 267)",
400400
"active": "#161517",
401401
"disabled": "#dfdfdf",
402-
"loading": "linear-gradient(\n 90deg,\n rgb(61, 59, 60) 0%,\n rgba(255, 255, 255, 0.3) 50%,\n rgb(61, 59, 60) 100%\n)"
402+
"loading": "linear-gradient(90deg, rgb(61, 59, 60) 0%, rgba(255, 255, 255, 0.3) 50%, rgb(61, 59, 60) 100%)"
403403
},
404404
"stroke": {
405405
"default": "#302e32",
@@ -420,7 +420,7 @@
420420
"hover": "#f6f7fa",
421421
"active": "lch(95.3 1.54 272)",
422422
"disabled": "#dfdfdf",
423-
"loading": "linear-gradient(\n 90deg,\n rgb(232, 233, 235) 0%,\n rgba(255, 255, 255, 0.95) 50%,\n rgb(232, 233, 235) 100%\n)"
423+
"loading": "linear-gradient(90deg, rgb(232, 233, 235) 0%, rgba(255, 255, 255, 0.95) 50%, rgb(232, 233, 235) 100%)"
424424
},
425425
"stroke": {
426426
"default": "#e6e7e9",
@@ -447,7 +447,7 @@
447447
"hover": "rgb(100% 13.7% 13.7% / 0.2)",
448448
"active": "rgb(100% 13.7% 13.7% / 0.3)",
449449
"disabled": "#dfdfdf",
450-
"loading": "linear-gradient(\n 90deg,\n rgba(255, 35, 35, 0.05) 0%,\n rgba(255, 255, 255, 0.8) 50%,\n rgba(255, 35, 35, 0.05) 100%\n)"
450+
"loading": "linear-gradient(90deg, rgba(255, 35, 35, 0.05) 0%, rgba(255, 255, 255, 0.8) 50%, rgba(255, 35, 35, 0.05) 100%)"
451451
},
452452
"stroke": {
453453
"default": "rgb(100% 13.7% 13.7% / 0.1)",
@@ -468,7 +468,7 @@
468468
"hover": "#f6f7fa",
469469
"active": "rgba(0,0,0,0)",
470470
"disabled": "rgba(0,0,0,0)",
471-
"loading": "linear-gradient(\n 90deg,\n rgb(240, 242, 248) 0%,\n rgba(255, 255, 255, 0.8) 50%,\n rgb(240, 242, 248) 100%\n)"
471+
"loading": "linear-gradient(90deg, rgb(240, 242, 248) 0%, rgba(255, 255, 255, 0.8) 50%, rgb(240, 242, 248) 100%)"
472472
},
473473
"stroke": {
474474
"default": "rgba(0,0,0,0)",

src/theme/tokens/variables.light.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@
173173
"hover": "lch(29.5 4.18 267)",
174174
"active": "#161517",
175175
"disabled": "#dfdfdf",
176-
"loading": "linear-gradient(\n 90deg,\n rgb(61, 59, 60) 0%,\n rgba(255, 255, 255, 0.3) 50%,\n rgb(61, 59, 60) 100%\n)"
176+
"loading": "linear-gradient(90deg, rgb(61, 59, 60) 0%, rgba(255, 255, 255, 0.3) 50%, rgb(61, 59, 60) 100%)"
177177
},
178178
"stroke": {
179179
"default": "#302e32",
@@ -194,7 +194,7 @@
194194
"hover": "#f6f7fa",
195195
"active": "lch(95.3 1.54 272)",
196196
"disabled": "#dfdfdf",
197-
"loading": "linear-gradient(\n 90deg,\n rgb(232, 233, 235) 0%,\n rgba(255, 255, 255, 0.95) 50%,\n rgb(232, 233, 235) 100%\n)"
197+
"loading": "linear-gradient(90deg, rgb(232, 233, 235) 0%, rgba(255, 255, 255, 0.95) 50%, rgb(232, 233, 235) 100%)"
198198
},
199199
"stroke": {
200200
"default": "#e6e7e9",
@@ -221,7 +221,7 @@
221221
"hover": "rgb(100% 13.7% 13.7% / 0.2)",
222222
"active": "rgb(100% 13.7% 13.7% / 0.3)",
223223
"disabled": "#dfdfdf",
224-
"loading": "linear-gradient(\n 90deg,\n rgba(255, 35, 35, 0.05) 0%,\n rgba(255, 255, 255, 0.8) 50%,\n rgba(255, 35, 35, 0.05) 100%\n)"
224+
"loading": "linear-gradient(90deg, rgba(255, 35, 35, 0.05) 0%, rgba(255, 255, 255, 0.8) 50%, rgba(255, 35, 35, 0.05) 100%)"
225225
},
226226
"stroke": {
227227
"default": "rgb(100% 13.7% 13.7% / 0.1)",
@@ -242,7 +242,7 @@
242242
"hover": "#f6f7fa",
243243
"active": "rgba(0,0,0,0)",
244244
"disabled": "rgba(0,0,0,0)",
245-
"loading": "linear-gradient(\n 90deg,\n rgb(240, 242, 248) 0%,\n rgba(255, 255, 255, 0.8) 50%,\n rgb(240, 242, 248) 100%\n)"
245+
"loading": "linear-gradient(90deg, rgb(240, 242, 248) 0%, rgba(255, 255, 255, 0.8) 50%, rgb(240, 242, 248) 100%)"
246246
},
247247
"stroke": {
248248
"default": "rgba(0,0,0,0)",

0 commit comments

Comments
 (0)