2019-08-03 05:32:42 +08:00
|
|
|
import React, { PureComponent } from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import { defineMessages, injectIntl } from 'react-intl';
|
2022-02-15 04:20:50 +08:00
|
|
|
import Button from '/imports/ui/components/common/button/component';
|
2021-10-30 00:35:08 +08:00
|
|
|
import Styled from './styles';
|
2019-08-03 05:32:42 +08:00
|
|
|
|
|
|
|
const propTypes = {
|
|
|
|
autoplayBlockedDesc: PropTypes.string.isRequired,
|
|
|
|
autoplayAllowLabel: PropTypes.string.isRequired,
|
|
|
|
handleAllowAutoplay: PropTypes.func.isRequired,
|
|
|
|
intl: PropTypes.objectOf(Object).isRequired,
|
|
|
|
};
|
|
|
|
|
|
|
|
const intlMessages = defineMessages({
|
|
|
|
autoplayAlertDesc: {
|
|
|
|
id: 'app.media.autoplayAlertDesc',
|
|
|
|
description: 'Description for the autoplay alert title',
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
class AutoplayOverlay extends PureComponent {
|
|
|
|
render() {
|
|
|
|
const {
|
|
|
|
intl,
|
|
|
|
handleAllowAutoplay,
|
|
|
|
autoplayBlockedDesc,
|
|
|
|
autoplayAllowLabel,
|
|
|
|
} = this.props;
|
|
|
|
return (
|
2021-10-30 00:35:08 +08:00
|
|
|
<Styled.AutoplayOverlay>
|
|
|
|
<Styled.Title>
|
2019-08-03 05:32:42 +08:00
|
|
|
{ intl.formatMessage(intlMessages.autoplayAlertDesc) }
|
2021-10-30 00:35:08 +08:00
|
|
|
</Styled.Title>
|
|
|
|
<Styled.AutoplayOverlayContent>
|
|
|
|
<Styled.Label>
|
2019-08-03 05:32:42 +08:00
|
|
|
{autoplayBlockedDesc}
|
2021-10-30 00:35:08 +08:00
|
|
|
</Styled.Label>
|
2019-08-03 05:32:42 +08:00
|
|
|
<Button
|
|
|
|
color="primary"
|
|
|
|
label={autoplayAllowLabel}
|
|
|
|
onClick={handleAllowAutoplay}
|
|
|
|
role="button"
|
|
|
|
size="lg"
|
|
|
|
/>
|
2021-10-30 00:35:08 +08:00
|
|
|
</Styled.AutoplayOverlayContent>
|
|
|
|
</Styled.AutoplayOverlay>
|
2019-08-03 05:32:42 +08:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
AutoplayOverlay.propTypes = propTypes;
|
|
|
|
|
|
|
|
export default injectIntl(AutoplayOverlay);
|