diff --git a/app/soapbox/components/upload-progress.tsx b/app/soapbox/components/upload-progress.tsx new file mode 100644 index 000000000..d910747cb --- /dev/null +++ b/app/soapbox/components/upload-progress.tsx @@ -0,0 +1,42 @@ +import React from 'react'; +import { FormattedMessage } from 'react-intl'; +import { spring } from 'react-motion'; + +import { HStack, Icon, Stack, Text } from 'soapbox/components/ui'; +import Motion from 'soapbox/features/ui/util/optional_motion'; + +interface IUploadProgress { + /** Number between 0 and 1 to represent the percentage complete. */ + progress: number, +} + +/** Displays a progress bar for uploading files. */ +const UploadProgress: React.FC = ({ progress }) => { + return ( + + + + + + + + +
+ + {({ width }) => + (
) + } + +
+ + + ); +}; + +export default UploadProgress; diff --git a/app/soapbox/features/compose/components/upload-progress.tsx b/app/soapbox/features/compose/components/upload-progress.tsx index 1c891653e..083cbf675 100644 --- a/app/soapbox/features/compose/components/upload-progress.tsx +++ b/app/soapbox/features/compose/components/upload-progress.tsx @@ -1,13 +1,10 @@ import React from 'react'; -import { FormattedMessage } from 'react-intl'; -import { spring } from 'react-motion'; -import { HStack, Icon, Stack, Text } from 'soapbox/components/ui'; +import UploadProgress from 'soapbox/components/upload-progress'; import { useAppSelector } from 'soapbox/hooks'; -import Motion from '../../ui/util/optional_motion'; - -const UploadProgress = () => { +/** File upload progress bar for post composer. */ +const ComposeUploadProgress = () => { const active = useAppSelector((state) => state.compose.get('is_uploading')); const progress = useAppSelector((state) => state.compose.get('progress')); @@ -16,30 +13,8 @@ const UploadProgress = () => { } return ( - - - - - - - - -
- - {({ width }) => - (
) - } - -
- - + ); }; -export default UploadProgress; +export default ComposeUploadProgress;