Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/violet-needles-fly.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"thirdweb": patch
---

Fix Spinner animation not working sometimes in Next.js
18 changes: 9 additions & 9 deletions packages/thirdweb/src/react/web/ui/components/Spinner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { keyframes } from "@emotion/react";
import { useCustomTheme } from "../../../core/design-system/CustomThemeProvider.js";
import type { Theme } from "../../../core/design-system/index.js";
import { iconSize } from "../../../core/design-system/index.js";
import { StyledCircle, StyledSvg } from "../design-system/elements.js";
import { StyledSvg } from "../design-system/elements.js";

/**
* @internal
Expand All @@ -24,20 +24,25 @@ export const Spinner: React.FC<{
viewBox="0 0 50 50"
className="tw-spinner"
>
<Circle
<circle
cx="25"
cy="25"
fill="none"
r="20"
style={{
strokeLinecap: "round",
animation: `tw-spinner-circle-dash 1.5s ease-in-out infinite`,
}}
stroke={props.color ? theme.colors[props.color] : "currentColor"}
strokeWidth={Number(iconSize[props.size]) > 64 ? "2" : "4"}
/>
<style>{dashAnimation}</style>
</Svg>
);
};

// animations
const dashAnimation = keyframes`
const dashAnimation = `
@keyframes tw-spinner-circle-dash {
0% {
stroke-dasharray: 1, 150;
stroke-dashoffset: 0;
Expand All @@ -63,8 +68,3 @@ const Svg = /* @__PURE__ */ StyledSvg({
height: "1em",
width: "1em",
});

const Circle = /* @__PURE__ */ StyledCircle({
animation: `${dashAnimation} 1.5s ease-in-out infinite`,
strokeLinecap: "round",
});
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import styled from "@emotion/styled";

export const StyledDiv = /* @__PURE__ */ styled.div;
export const StyledSvg = /* @__PURE__ */ styled.svg;
export const StyledCircle = /* @__PURE__ */ styled.circle;
export const StyledSpan = /* @__PURE__ */ styled.span;
export const StyledAnchor = /* @__PURE__ */ styled.a;
export const StyledButton = /* @__PURE__ */ styled.button;
Expand Down
Loading