Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add loading animation to upload doc modal #654

Open
wants to merge 6 commits into
base: Development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/components/Modals/UploadDocumentModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import ClearIcon from '@mui/icons-material/Clear';
import DialogActions from '@mui/material/DialogActions';
import FileUploadIcon from '@mui/icons-material/FileUpload';
import FormControl from '@mui/material/FormControl';
import Backdrop from '@mui/material/Backdrop';
// import FormControlLabel from '@mui/material/FormControlLabel';
import FormHelperText from '@mui/material/FormHelperText';
// import Switch from '@mui/material/Switch';
Expand All @@ -20,6 +21,7 @@ import { useTheme } from '@mui/material/styles';
// Context Imports
import { DocumentListContext } from '@contexts';
// Component Imports
import { LoadingAnimation } from '@components/Notification';
import ModalBase from './ModalBase';
import { DocumentSelection, FormSection } from '../Form';
import UploadButtonGroup from './UploadButtonGroup';
Expand Down Expand Up @@ -223,6 +225,9 @@ const UploadDocumentModal = ({ showModal, setShowModal }) => {
</FormControl>
</form>
</FormSection>
<Backdrop open={processing}>
<LoadingAnimation loadingItem={file?.name} isModal />
</Backdrop>
</ModalBase>
);
};
Expand Down
14 changes: 12 additions & 2 deletions src/components/Notification/LoadingAnimation.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@
* @name LoadingAnimation
* @param {object} Props - Component props for LoadingAnimation
* @param {string} Props.loadingItem - The name of what you plan on loading
* @param {boolean} Props.isModal - If component is used in modal
* @param Props.isModal

Check warning on line 22 in src/components/Notification/LoadingAnimation.jsx

View workflow job for this annotation

GitHub Actions / Lint

Duplicate @param "Props.isModal"

Check warning on line 22 in src/components/Notification/LoadingAnimation.jsx

View workflow job for this annotation

GitHub Actions / Lint

Missing JSDoc @param "Props.isModal" description

Check warning on line 22 in src/components/Notification/LoadingAnimation.jsx

View workflow job for this annotation

GitHub Actions / Lint

Missing JSDoc @param "Props.isModal" type
* @param {React.JSX.Element} [Props.children] - If used as a provider, wrapped
* component will be used as the animation
* @returns {React.ReactElement} Div of what is currently loading
*/
const LoadingAnimation = ({ loadingItem, children }) => (
const LoadingAnimation = ({ loadingItem, children, isModal }) => (
<Box
sx={{
my: '3rem',
Expand All @@ -34,7 +36,15 @@
}}
data-testid="loading-animation"
>
<Paper elevation={2} sx={{ display: 'inline-block', mx: '2px', padding: '20px' }}>
<Paper
elevation={2}
sx={{
display: 'inline-block',
mx: '2px',
padding: '20px',
backgroundColor: isModal ? 'background.tint' : 'background.main'
}}
>
<Typography variant="h5" component="h2" mb={2} align="center">
Loading {loadingItem}...
</Typography>
Expand Down
Loading