2019-05-17 04:11:10 +08:00
|
|
|
import React from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import cx from 'classnames';
|
|
|
|
import { defineMessages, injectIntl, intlShape } from 'react-intl';
|
|
|
|
import { styles } from '/imports/ui/components/actions-bar/styles';
|
|
|
|
import Button from '/imports/ui/components/button/component';
|
|
|
|
|
|
|
|
const propTypes = {
|
|
|
|
intl: intlShape.isRequired,
|
2019-05-18 04:02:28 +08:00
|
|
|
isActive: PropTypes.bool.isRequired,
|
2019-05-17 04:11:10 +08:00
|
|
|
handleOnClick: PropTypes.func.isRequired,
|
|
|
|
};
|
|
|
|
|
|
|
|
const intlMessages = defineMessages({
|
|
|
|
start: {
|
|
|
|
id: 'app.actionsBar.captions.start',
|
|
|
|
description: 'Start closed captions option',
|
|
|
|
},
|
|
|
|
stop: {
|
|
|
|
id: 'app.actionsBar.captions.stop',
|
|
|
|
description: 'Stop closed captions option',
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2019-05-18 04:02:28 +08:00
|
|
|
const CaptionsButton = ({ intl, isActive, handleOnClick }) => {
|
2019-05-17 04:11:10 +08:00
|
|
|
return (
|
|
|
|
<Button
|
2019-05-18 04:02:28 +08:00
|
|
|
className={cx(styles.button, isActive || styles.btn)}
|
2019-05-17 04:11:10 +08:00
|
|
|
icon="polling"
|
2019-05-18 04:02:28 +08:00
|
|
|
label={intl.formatMessage(isActive ? intlMessages.stop : intlMessages.start)}
|
|
|
|
color={isActive ? 'primary' : 'default'}
|
|
|
|
ghost={!isActive}
|
2019-05-17 04:11:10 +08:00
|
|
|
hideLabel
|
|
|
|
circle
|
|
|
|
size="lg"
|
|
|
|
onClick={handleOnClick}
|
2019-05-18 04:02:28 +08:00
|
|
|
id={isActive ? 'stop-captions-button' : 'start-captions-button'}
|
2019-05-17 04:11:10 +08:00
|
|
|
/>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
CaptionsButton.propTypes = propTypes;
|
|
|
|
export default injectIntl(CaptionsButton);
|