Skip to content

Commit

Permalink
Add loading icon to be displayed while fetching data from REST API
Browse files Browse the repository at this point in the history
  • Loading branch information
dross20 committed Oct 25, 2024
1 parent 54d3512 commit aa34b6f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/DonationCharityForm/DonationCharityForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ function charityForm () {
}}>
{selectedOrg.length === org.length ? 'Deselect All' : 'Select All'}
</a>
{org.length === 0 ? ( <div class="loader"></div> ) : <></>}

Check failure on line 75 in src/DonationCharityForm/DonationCharityForm.tsx

View workflow job for this annotation

GitHub Actions / deploy

Type '{ class: string; }' is not assignable to type 'DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>'.
<div className="checkbox-grid">
{org.map((org) => (
<label key={org.id} className="checkbox-label">
Expand Down
16 changes: 16 additions & 0 deletions src/DonationForm/DonationForm.css
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,19 @@ form label:hover {
width: 100%; /* Stack labels on small screens */
}
}

.loader {
border: 4px solid #f3f3f3; /* Light grey */
border-top: 4px solid #3498db; /* Blue */
border-radius: 100%;
width: 24px;
height: 24px;
animation: spin 2s linear infinite;
margin-left: auto;
margin-right: auto;
}

@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
1 change: 1 addition & 0 deletions src/DonationItemForm/DonationItemForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ import './DonationItemsForm.css'; // Assuming you create a CSS file for styling
}}>
Clear selections
</a>
{items.length === 0 ? ( <div class="loader"></div> ) : <></>}

Check failure on line 65 in src/DonationItemForm/DonationItemForm.tsx

View workflow job for this annotation

GitHub Actions / deploy

Type '{ class: string; }' is not assignable to type 'DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>'.
<div className="checkbox-grid">
{items.map((item) => (
<label key={item.id} className="checkbox-label">
Expand Down

0 comments on commit aa34b6f

Please sign in to comment.