import React from 'react'; import { defineMessages, injectIntl, intlShape } from 'react-intl'; import Button from '/imports/ui/components/button/component'; import cx from 'classnames'; import PropTypes from 'prop-types'; import { styles } from './styles'; const intlMessages = defineMessages({ fullscreenButton: { id: 'app.fullscreenButton.label', description: 'Fullscreen label', }, }); const propTypes = { intl: intlShape.isRequired, fullscreenRef: PropTypes.instanceOf(Element), dark: PropTypes.bool, bottom: PropTypes.bool, isIphone: PropTypes.bool, isFullscreen: PropTypes.bool, elementName: PropTypes.string, className: PropTypes.string, handleToggleFullScreen: PropTypes.func.isRequired, }; const defaultProps = { dark: false, bottom: false, isIphone: false, isFullscreen: false, elementName: '', className: '', fullscreenRef: null, }; const FullscreenButtonComponent = ({ intl, dark, bottom, elementName, className, fullscreenRef, handleToggleFullScreen, isIphone, isFullscreen, }) => { if (isIphone) return null; const formattedLabel = intl.formatMessage( intlMessages.fullscreenButton, ({ 0: elementName || '' }), ); const wrapperClassName = cx({ [styles.wrapper]: true, [styles.dark]: dark, [styles.light]: !dark, [styles.top]: !bottom, [styles.bottom]: bottom, }); return (