Skip to content

Commit 0b82abd

Browse files
committed
refactor(Rotate): remove autoplay functionality and associated controls for cleaner interaction
1 parent 40663de commit 0b82abd

File tree

1 file changed

+1
-21
lines changed

1 file changed

+1
-21
lines changed

packages/react-components/react-motion-components-preview/stories/src/Rotate/RotateDefault.stories.tsx

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import {
33
Field,
44
makeStyles,
55
tokens,
6-
Switch,
76
useId,
87
Label,
98
Slider,
@@ -96,7 +95,6 @@ const LoremIpsum = () => (
9695
export const Default = (props: React.ComponentProps<typeof Rotate>) => {
9796
const classes = useClasses();
9897
const [visible, setVisible] = React.useState<boolean>(false);
99-
const [autoplay, setAutoplay] = React.useState<boolean>(false);
10098
const [perspective, setPerspective] = React.useState<string>('1000px');
10199
const [duration, setDuration] = React.useState<number>(motionTokens.durationUltraSlow); // 500ms
102100
const [axis, setAxis] = React.useState<Axis3D>('y');
@@ -122,18 +120,6 @@ export const Default = (props: React.ComponentProps<typeof Rotate>) => {
122120
<Button className={classes.ctaButton} appearance="primary" size="large" onClick={() => setVisible(v => !v)}>
123121
{visible ? 'Hide' : 'Show'}
124122
</Button>
125-
<Field>
126-
<Switch
127-
label="Autoplay"
128-
checked={autoplay}
129-
onChange={() => {
130-
if (!autoplay) {
131-
setVisible(!visible);
132-
}
133-
return setAutoplay(v => !v);
134-
}}
135-
/>
136-
</Field>
137123
</div>
138124
</div>
139125

@@ -207,13 +193,7 @@ export const Default = (props: React.ComponentProps<typeof Rotate>) => {
207193
</div>
208194
</div>
209195

210-
<Rotate
211-
visible={visible}
212-
axis={axis}
213-
angle={angle}
214-
duration={duration}
215-
onMotionFinish={() => autoplay && setVisible(v => !v)}
216-
>
196+
<Rotate visible={visible} axis={axis} angle={angle} duration={duration}>
217197
<div className={classes.card}>
218198
<LoremIpsum />
219199
</div>

0 commit comments

Comments
 (0)