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' }, }) export default @injectIntl class UploadArea extends PureComponent { static propTypes = { active: PropTypes.bool, onClose: PropTypes.func, intl: PropTypes.object.isRequired, } 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)}
)} ) } }