mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-08 20:57:08 +08:00
@@ -30,13 +30,8 @@ Pause.args = {
|
||||
state: 'pause',
|
||||
};
|
||||
|
||||
export const Loading = Template.bind({});
|
||||
Loading.args = {
|
||||
state: 'loading',
|
||||
};
|
||||
|
||||
export const WithStateToggle: StoryFn<typeof AnimatedPlayIcon> = () => {
|
||||
const [state, setState] = useState<'play' | 'pause' | 'loading'>('play');
|
||||
const [state, setState] = useState<'play' | 'pause'>('play');
|
||||
|
||||
const cycleState = () => {
|
||||
setState(current => {
|
||||
@@ -45,8 +40,6 @@ export const WithStateToggle: StoryFn<typeof AnimatedPlayIcon> = () => {
|
||||
return 'pause';
|
||||
case 'pause':
|
||||
return 'play';
|
||||
case 'loading':
|
||||
return 'play';
|
||||
default:
|
||||
return 'play';
|
||||
}
|
||||
|
||||
@@ -4,12 +4,11 @@ import type { LottieRef } from 'lottie-react';
|
||||
import Lottie from 'lottie-react';
|
||||
import { useEffect, useRef } from 'react';
|
||||
|
||||
import { Loading } from '../loading';
|
||||
import playandpause from './playandpause.json';
|
||||
import * as styles from './styles.css';
|
||||
|
||||
export interface AnimatedPlayIconProps {
|
||||
state: 'play' | 'pause' | 'loading';
|
||||
state: 'play' | 'pause';
|
||||
className?: string;
|
||||
onClick?: (e: React.MouseEvent) => void;
|
||||
}
|
||||
@@ -62,9 +61,6 @@ export const AnimatedPlayIcon = ({
|
||||
onClick,
|
||||
}: AnimatedPlayIconProps) => {
|
||||
const state = useDebouncedValue(_state, 25);
|
||||
if (state === 'loading') {
|
||||
return <Loading size={40} />;
|
||||
}
|
||||
return (
|
||||
<PlayAndPauseIcon state={state} onClick={onClick} className={className} />
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user