import React from 'react' import PropTypes from 'prop-types' import { defineMessages, injectIntl } from 'react-intl' import spring from 'react-motion/lib/spring' import Motion from '../features/ui/util/reduced_motion' import Text from './text' const messages = defineMessages({ title: { id: 'upload_area.title', defaultMessage: 'Drag & drop to upload' }, }) class UploadArea extends React.PureComponent { handleKeyUp = (e) => { if (!this.props.active) return const keyCode = e.keyCode switch(keyCode) { case 27: e.preventDefault() e.stopPropagation() this.props.onClose() break } } componentDidMount () { window.addEventListener('keyup', this.handleKeyUp, false) } componentWillUnmount () { window.removeEventListener('keyup', this.handleKeyUp) } render () { const { active, intl } = this.props return ( {({ backgroundOpacity, backgroundScale }) => (
{intl.formatMessage(messages.title)}
)} ) } } UploadArea.propTypes = { active: PropTypes.bool, onClose: PropTypes.func, intl: PropTypes.object.isRequired, } export default injectIntl(UploadArea)