-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
play-control.tsx
44 lines (40 loc) · 1.22 KB
/
play-control.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import React from 'react';
import classnames from 'classnames';
import {FormattedMessage} from 'localization';
import {Tooltip} from 'components/common/styled-components';
import IconButton from '../icon-button';
const DELAY_SHOW = 500;
function PlayControlFactory() {
const PlayControl = ({
showAnimationWindowControl,
isAnimating,
pauseAnimation,
startAnimation,
isSpeedControlVisible,
btnStyle,
playbackIcons,
buttonHeight
}) => {
return showAnimationWindowControl ? null : (
<IconButton
data-tip
data-for="animate-play-pause"
className={classnames('playback-control-button', {active: isAnimating})}
onClick={isAnimating ? pauseAnimation : startAnimation}
hide={isSpeedControlVisible}
{...btnStyle}
>
{isAnimating ? (
<playbackIcons.pause height={buttonHeight} />
) : (
<playbackIcons.play height={buttonHeight} />
)}
<Tooltip id="animate-play-pause" place="top" delayShow={DELAY_SHOW} effect="solid">
<FormattedMessage id={isAnimating ? 'tooltip.pause' : 'tooltip.play'} />
</Tooltip>
</IconButton>
);
};
return PlayControl;
}
export default PlayControlFactory;