Skip to content

Commit 76f4df6

Browse files
committed
[MNY-334] SDK: Fix Spinner animation missing sometimes in Next.js
1 parent 724a4cb commit 76f4df6

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

.changeset/violet-needles-fly.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"thirdweb": patch
3+
---
4+
5+
Fix Spinner animation not working sometimes in Next.js

packages/thirdweb/src/react/web/ui/components/Spinner.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { keyframes } from "@emotion/react";
33
import { useCustomTheme } from "../../../core/design-system/CustomThemeProvider.js";
44
import type { Theme } from "../../../core/design-system/index.js";
55
import { iconSize } from "../../../core/design-system/index.js";
6-
import { StyledCircle, StyledSvg } from "../design-system/elements.js";
6+
import { StyledSvg } from "../design-system/elements.js";
77

88
/**
99
* @internal
@@ -24,20 +24,25 @@ export const Spinner: React.FC<{
2424
viewBox="0 0 50 50"
2525
className="tw-spinner"
2626
>
27-
<Circle
27+
<circle
2828
cx="25"
2929
cy="25"
3030
fill="none"
3131
r="20"
32+
style={{
33+
strokeLinecap: "round",
34+
animation: `tw-spinner-circle-dash 1.5s ease-in-out infinite`,
35+
}}
3236
stroke={props.color ? theme.colors[props.color] : "currentColor"}
3337
strokeWidth={Number(iconSize[props.size]) > 64 ? "2" : "4"}
3438
/>
39+
<style>{dashAnimation}</style>
3540
</Svg>
3641
);
3742
};
38-
3943
// animations
40-
const dashAnimation = keyframes`
44+
const dashAnimation = `
45+
@keyframes tw-spinner-circle-dash {
4146
0% {
4247
stroke-dasharray: 1, 150;
4348
stroke-dashoffset: 0;
@@ -63,8 +68,3 @@ const Svg = /* @__PURE__ */ StyledSvg({
6368
height: "1em",
6469
width: "1em",
6570
});
66-
67-
const Circle = /* @__PURE__ */ StyledCircle({
68-
animation: `${dashAnimation} 1.5s ease-in-out infinite`,
69-
strokeLinecap: "round",
70-
});

0 commit comments

Comments
 (0)