Skip to content

Commit 80bc0fd

Browse files
committed
Update useAnimation.stories.tsx
1 parent fb5b28f commit 80bc0fd

File tree

1 file changed

+9
-39
lines changed

1 file changed

+9
-39
lines changed

stories/hooks/useAnimation.stories.tsx

+9-39
Original file line numberDiff line numberDiff line change
@@ -70,34 +70,10 @@ export const Hello: StoryObj = {
7070
</g>
7171
</svg>
7272
<div>
73-
<button
74-
onClick={() => {
75-
animate.play();
76-
}}
77-
>
78-
play
79-
</button>
80-
<button
81-
onClick={() => {
82-
animate.pause();
83-
}}
84-
>
85-
pause
86-
</button>
87-
<button
88-
onClick={() => {
89-
animate.reverse();
90-
}}
91-
>
92-
reverse
93-
</button>
94-
<button
95-
onClick={() => {
96-
animate.finish();
97-
}}
98-
>
99-
finish
100-
</button>
73+
<button onClick={animate.play}>play</button>
74+
<button onClick={animate.pause}>pause</button>
75+
<button onClick={animate.reverse}>reverse</button>
76+
<button onClick={animate.finish}>finish</button>
10177
</div>
10278
<div>
10379
<label>
@@ -382,7 +358,7 @@ export const Square: StoryObj = {
382358
width: "6rem",
383359
margin: "2rem 0 2rem 2rem",
384360
}}
385-
></div>
361+
/>
386362
);
387363
},
388364
};
@@ -398,13 +374,9 @@ export const Toggle: StoryObj = {
398374
animate.play();
399375
}, [animate]);
400376

401-
const onClick = useCallback(() => {
402-
animate.reverse();
403-
}, [animate]);
404-
405377
return (
406378
<div>
407-
<button onClick={onClick}>Toggle</button>
379+
<button onClick={animate.reverse}>Toggle</button>
408380
<div className="rail">
409381
<div ref={animate.ref} className="block" />
410382
</div>
@@ -455,11 +427,9 @@ export const Path: StoryObj = {
455427
const height = 300;
456428

457429
return (
458-
<>
459-
<svg width={width} height={height} viewBox={`0 0 ${width} ${height}`}>
460-
<path ref={animate.ref} fill="orange" />
461-
</svg>
462-
</>
430+
<svg width={width} height={height} viewBox={`0 0 ${width} ${height}`}>
431+
<path ref={animate.ref} fill="orange" />
432+
</svg>
463433
);
464434
},
465435
};

0 commit comments

Comments
 (0)