bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/captions/button/component.jsx

41 lines
1.1 KiB
React
Raw Normal View History

import React from 'react';
import PropTypes from 'prop-types';
import { defineMessages, injectIntl } from 'react-intl';
2021-10-25 22:15:16 +08:00
import Styled from './styles';
const propTypes = {
2021-08-09 22:24:02 +08:00
intl: PropTypes.shape({
formatMessage: PropTypes.func.isRequired,
}).isRequired,
isActive: PropTypes.bool.isRequired,
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 }) => (
2021-10-25 22:15:16 +08:00
<Styled.CaptionsButton
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'}
/>
);
CaptionsButton.propTypes = propTypes;
export default injectIntl(CaptionsButton);