Skip to content

Commit c8cec17

Browse files
committed
fix(emcn): drive the loader spin period from a CSS variable instead of an inline style
1 parent 43d26eb commit c8cec17

3 files changed

Lines changed: 8 additions & 4 deletions

File tree

‎apps/sim/app/workspace/[workspaceId]/home/components/mothership-view/components/resource-registry/browser-tab-icon.tsx‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,8 @@ export function BrowserTabIcon({ tabId, scopeId, className }: BrowserTabIconProp
7474
{showSpinner ? (
7575
<Loader
7676
animate
77-
className='size-[14px] text-[var(--text-icon)]'
77+
className='size-[14px] text-[var(--text-icon)] [--loader-duration:650ms]'
7878
strokeWidth={2}
79-
style={{ animationDuration: '650ms' }}
8079
/>
8180
) : !faviconLoaded || faviconFailed ? (
8281
<Globe className='size-[12px] text-[var(--text-icon)]' />

‎packages/emcn/src/icons/animate/loader.module.css‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
* Loader icon animation
33
* Continuous spinning animation for loading states
44
* Uses GPU acceleration for smooth performance
5+
* The period is read from `--loader-duration` so a consumer can set it from a
6+
* utility class (`[--loader-duration:650ms]`); the module's own `animation`
7+
* shorthand is unlayered and would otherwise beat any Tailwind override.
58
*/
69

710
@keyframes spin {
@@ -14,7 +17,7 @@
1417
}
1518

1619
.animated-loader-svg {
17-
animation: spin 1s linear infinite;
20+
animation: spin var(--loader-duration, 1s) linear infinite;
1821
transform-origin: center center;
1922
will-change: transform;
2023
}

‎packages/emcn/src/icons/loader.tsx‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ export interface LoaderProps extends SVGProps<SVGSVGElement> {
1414
* Loader icon component with optional CSS-based spinning animation
1515
* Based on refresh-cw but without the arrows, just the circular arcs.
1616
* When animate is false, this is a lightweight static icon with no animation overhead.
17-
* When animate is true, CSS module animations are applied for continuous spin.
17+
* When animate is true, CSS module animations are applied for continuous spin;
18+
* the period defaults to 1s and follows `--loader-duration` when a consumer sets it
19+
* (for example `className='[--loader-duration:650ms]'`).
1820
* @param props - SVG properties including className, animate, etc.
1921
*/
2022
export function Loader({ animate = false, className, ...props }: LoaderProps) {

0 commit comments

Comments
 (0)