import classNames from 'classnames'; import PropTypes from 'prop-types'; import * as React from 'react'; import { FormattedMessage } from 'react-intl'; import spring from 'react-motion/lib/spring'; import { Icon, Stack, Text } from 'soapbox/components/ui'; import Motion from '../../ui/util/optional_motion'; const UploadArea = ({ active, onClose }) => { const handleKeyUp = (e) => { const keyCode = e.keyCode; if (active) { switch(keyCode) { case 27: e.preventDefault(); e.stopPropagation(); onClose(); break; } } }; React.useEffect(() => { window.addEventListener('keyup', handleKeyUp, false); return () => window.removeEventListener('keyup', handleKeyUp); }, []); return ( {({ backgroundOpacity, backgroundScale }) => (
)} ); }; UploadArea.propTypes = { active: PropTypes.bool, onClose: PropTypes.func, }; export default UploadArea;