2019-05-17 04:11:10 +08:00
|
|
|
import React from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import cx from 'classnames';
|
2020-05-26 04:00:13 +08:00
|
|
|
import { defineMessages, injectIntl } from 'react-intl';
|
2019-05-17 04:11:10 +08:00
|
|
|
import { styles } from '/imports/ui/components/actions-bar/styles';
|
|
|
|
import Button from '/imports/ui/components/button/component';
|
|
|
|
|
|
|
|
const propTypes = {
|
2020-05-26 04:00:13 +08:00
|
|
|
intl: PropTypes.object.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-29 22:31:27 +08:00
|
|
|
const CaptionsButton = ({ intl, isActive, handleOnClick }) => (
|
|
|
|
<Button
|
2020-03-10 05:33:56 +08:00
|
|
|
className={cx(isActive || styles.btn)}
|
2019-06-13 03:28:00 +08:00
|
|
|
icon="closed_caption"
|
2019-05-29 22:31:27 +08:00
|
|
|
label={intl.formatMessage(isActive ? intlMessages.stop : intlMessages.start)}
|
|
|
|
color={isActive ? 'primary' : 'default'}
|
|
|
|
ghost={!isActive}
|
|
|
|
hideLabel
|
|
|
|
circle
|
|
|
|
size="lg"
|
|
|
|
onClick={handleOnClick}
|
|
|
|
id={isActive ? 'stop-captions-button' : 'start-captions-button'}
|
|
|
|
/>
|
|
|
|
);
|
2019-05-17 04:11:10 +08:00
|
|
|
|
|
|
|
CaptionsButton.propTypes = propTypes;
|
|
|
|
export default injectIntl(CaptionsButton);
|