-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathPlayButton.js
More file actions
49 lines (45 loc) · 1.59 KB
/
PlayButton.js
File metadata and controls
49 lines (45 loc) · 1.59 KB
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
45
46
47
48
49
// @flow
import React from 'react';
import AriaDisablingButton from './AriaDisablingButton';
import classNames from 'classnames';
import { injectIntl } from 'react-intl';
import type { IntlShape } from 'react-intl';
import { ReactComponent as PlayIcon } from './svg/Play.svg';
import { ReactComponent as PauseIcon } from './svg/Pause.svg';
import './PlayButton.scss';
type PlayButtonProps = {
intl: IntlShape,
className: string,
interpreterIsRunning: boolean,
disabled: boolean,
onClick: () => void
};
class PlayButton extends React.Component<PlayButtonProps, {}> {
render() {
const classes = classNames(
this.props.className,
'PlayControlButton',
'PlayButton',
this.props.interpreterIsRunning && 'PlayButton--pause',
!this.props.interpreterIsRunning && 'PlayButton--play'
);
return (
<AriaDisablingButton
aria-label={
this.props.interpreterIsRunning ?
this.props.intl.formatMessage({id:'PlayButton.pause'}) :
this.props.intl.formatMessage({id:'PlayButton.play'})}
className={classes}
disabledClassName='PlayButton--disabled PlayControlButton--disabled'
disabled={this.props.disabled}
onClick={this.props.onClick}
>
{this.props.interpreterIsRunning ?
<PauseIcon /> :
<PlayIcon />
}
</AriaDisablingButton>
);
}
}
export default injectIntl(PlayButton);