Skip to content

Commit 13b8403

Browse files
committed
Move vars
1 parent 78e7da1 commit 13b8403

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

apps/builder/app/builder/features/settings-panel/props-section/animation/animation-ranges.tsx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ type AnimationRangesProps = ViewRangeOptionsSchema;
77

88
const insetSize = "60px";
99
const borderColor = "#ccc";
10+
const progressVariable = "--ws-progress";
1011

1112
const Wrapper = styled(Box, {
1213
position: "relative",
@@ -32,8 +33,8 @@ const Scrollable = styled(Box, {
3233
});
3334

3435
const bgKeyframes = keyframes({
35-
"0%": { "--progress": "0" },
36-
"100%": { "--progress": "360" },
36+
"0%": { [progressVariable]: "0" },
37+
"100%": { [progressVariable]: "360" },
3738
});
3839

3940
const rafInterval = (callback: () => void): (() => void) => {
@@ -58,7 +59,7 @@ export const AnimationRanges = (props: AnimationRangesProps) => {
5859
useEffect(() => {
5960
try {
6061
CSS.registerProperty({
61-
name: "--progress",
62+
name: progressVariable,
6263
syntax: "<number>",
6364
inherits: true,
6465
initialValue: "0",
@@ -120,6 +121,9 @@ export const AnimationRanges = (props: AnimationRangesProps) => {
120121
];
121122

122123
const progressRadius = "6px";
124+
const progressWidth = "4px";
125+
const progressInactiveColor = "oklch(92.9% 0.013 255.508)";
126+
const progressActiveColor = "oklch(54.6% 0.245 262.881)";
123127

124128
return (
125129
<Wrapper>
@@ -153,11 +157,10 @@ export const AnimationRanges = (props: AnimationRangesProps) => {
153157
inset: 0,
154158
borderRadius: progressRadius,
155159

156-
background: `conic-gradient(oklch(54.6% 0.245 262.881) calc(var(--progress, 0) * 1deg), oklch(92.9% 0.013 255.508) 0)`,
160+
background: `conic-gradient(${progressActiveColor} calc(var(${progressVariable}, 0) * 1deg), ${progressInactiveColor} 0)`,
157161
mask: `linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0)`,
158-
159162
maskComposite: `exclude`,
160-
padding: `4px`,
163+
padding: progressWidth,
161164
}}
162165
/>
163166

0 commit comments

Comments
 (0)