sforkowany z mirror/soapbox
Convert UploadArea to tsx
rodzic
e20a083fb4
commit
5def7a087d
|
@ -1,4 +1,3 @@
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { defineMessages, useIntl } from 'react-intl';
|
import { defineMessages, useIntl } from 'react-intl';
|
||||||
|
|
||||||
|
@ -75,9 +74,4 @@ const DeleteAccount = () => {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
DeleteAccount.propTypes = {
|
|
||||||
intl: PropTypes.object,
|
|
||||||
dispatch: PropTypes.func,
|
|
||||||
};
|
|
||||||
|
|
||||||
export default DeleteAccount;
|
export default DeleteAccount;
|
||||||
|
|
|
@ -1,15 +1,22 @@
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { FormattedMessage } from 'react-intl';
|
import { FormattedMessage } from 'react-intl';
|
||||||
import spring from 'react-motion/lib/spring';
|
import { spring } from 'react-motion';
|
||||||
|
|
||||||
import { Icon, Stack, Text } from 'soapbox/components/ui';
|
import { Icon, Stack, Text } from 'soapbox/components/ui';
|
||||||
|
|
||||||
import Motion from '../../ui/util/optional_motion';
|
import Motion from '../../ui/util/optional_motion';
|
||||||
|
|
||||||
const UploadArea = ({ active, onClose }) => {
|
interface IUploadArea {
|
||||||
const handleKeyUp = (e) => {
|
/** Whether the upload area is active. */
|
||||||
|
active: boolean,
|
||||||
|
/** Callback when the upload area is closed. */
|
||||||
|
onClose: () => void,
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Component to display when a file is dragged over the UI. */
|
||||||
|
const UploadArea: React.FC<IUploadArea> = ({ active, onClose }) => {
|
||||||
|
const handleKeyUp = (e: KeyboardEvent) => {
|
||||||
const keyCode = e.keyCode;
|
const keyCode = e.keyCode;
|
||||||
|
|
||||||
if (active) {
|
if (active) {
|
||||||
|
@ -63,9 +70,4 @@ const UploadArea = ({ active, onClose }) => {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
UploadArea.propTypes = {
|
|
||||||
active: PropTypes.bool,
|
|
||||||
onClose: PropTypes.func,
|
|
||||||
};
|
|
||||||
|
|
||||||
export default UploadArea;
|
export default UploadArea;
|
Ładowanie…
Reference in New Issue