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

ryan/feat(ux: create input loading spinner) #399

Merged
merged 49 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
fe61aee
feat(LoadingSpinner.tsx): created first iteration of a loading spinner
ryandotfurrer Jul 5, 2024
5d7fb40
feat(LoadingSpinner.tsx): added optional height and width props to co…
ryandotfurrer Jul 13, 2024
86c9e36
feat(LoadingSpinner.tsx): add accessibility features
ryandotfurrer Jul 13, 2024
f69924e
Merge branch 'develop' into ryan/create-input-loading-spinner
ryandotfurrer Jul 13, 2024
ba83fee
Merge branch 'develop' into ryan/create-input-loading-spinner
ryandotfurrer Jul 16, 2024
879e45d
Merge branch 'develop' into ryan/create-input-loading-spinner
ryandotfurrer Jul 16, 2024
0642af5
Merge branch 'develop' into ryan/create-input-loading-spinner
ryandotfurrer Jul 16, 2024
9fe6c06
Merge remote-tracking branch 'origin/develop' into ryan/create-input-…
ryandotfurrer Jul 17, 2024
cfbb118
Merge branch 'ryan/create-input-loading-spinner' of https://github.co…
ryandotfurrer Jul 17, 2024
91a1cad
Merge branch 'develop' into ryan/create-input-loading-spinner
ryandotfurrer Jul 19, 2024
3ae4268
Merge branch 'develop' into ryan/create-input-loading-spinner
ryandotfurrer Jul 19, 2024
8555c8c
feat(page.tsx): remove loading spinner component from league/all page
ryandotfurrer Jul 19, 2024
d1ea90e
feat(LoadingSpinner.tsx): made loadingspinner respect min and max hei…
ryandotfurrer Jul 19, 2024
0a97191
fix(LeagueCard.tsx): remove hard height on leaguecard component
ryandotfurrer Jul 19, 2024
0a17029
test(LoadingSpinner.test.tsx): create test for loadingspinner component
ryandotfurrer Jul 19, 2024
ddf61e9
Merge branch 'develop' into ryan/create-input-loading-spinner
ryandotfurrer Jul 23, 2024
b13771f
fix(LeagueCard.tsx): added hover styles that were unintentionally rem…
ryandotfurrer Jul 23, 2024
7405e32
fix(league/all/page.tsx): revereted loading text value back so the te…
ryandotfurrer Jul 23, 2024
f951b9f
Merge branch 'develop' into ryan/create-input-loading-spinner
ryandotfurrer Jul 25, 2024
896684d
fix(/login/page.tsx): added router import
ryandotfurrer Jul 26, 2024
ada9f2a
test(LoadingSpinner.test.tsx): test only the loadingspinner component…
ryandotfurrer Jul 27, 2024
f4f6297
fix(register/page.tsx-and-login/page.tsx): updated userouter import t…
ryandotfurrer Jul 27, 2024
10d8372
Merge branch 'develop' into ryan/create-input-loading-spinner
ryandotfurrer Jul 30, 2024
6750360
Merge branch 'develop' into ryan/create-input-loading-spinner
ryandotfurrer Jul 31, 2024
6e05eee
Merge branch 'develop' into ryan/create-input-loading-spinner
ryandotfurrer Aug 8, 2024
a5ff75e
feat(loadingspinner.tsx): move data-testid to loadingspinner containi…
ryandotfurrer Aug 9, 2024
c57250a
test(LoadingSpinner.test.tsx): remove line checking for classes as I …
ryandotfurrer Aug 9, 2024
a09b347
Merge branch 'develop' of https://github.com/LetsGetTechnical/gridiro…
ryandotfurrer Aug 13, 2024
3691ac6
change buttonprops label type and remove react from loadingspinner fo…
ryandotfurrer Aug 13, 2024
2fcd56a
(button.tsx): change previous change on buttonprops label to a string…
ryandotfurrer Aug 13, 2024
f8159f1
Merge branch 'develop' into ryan/create-input-loading-spinner
ryandotfurrer Aug 14, 2024
5bbb240
sort imports in login page.tsx
ryandotfurrer Aug 15, 2024
045fea2
attempt at adding test to login page for loading spinner
ryandotfurrer Aug 16, 2024
6a45440
feat(login/page.tsx): add try and catch statements to onSubmit function
ryandotfurrer Aug 16, 2024
efbf890
attempt to make loadingspinner test work
ryandotfurrer Aug 16, 2024
4b7be56
implemented shashi's testing logic for the loadingspinner on the logi…
ryandotfurrer Aug 21, 2024
dd0f185
Merge branch 'develop' into ryan/create-input-loading-spinner
ryandotfurrer Aug 21, 2024
bbce891
Clue355/feat(#449): Use input spinner for submission buttons (#453)
Clue355 Aug 26, 2024
42f4023
Merge branch 'develop' into ryan/create-input-loading-spinner
ryandotfurrer Aug 29, 2024
0803b5a
address comments in latest PR review including updating the login pag…
ryandotfurrer Aug 29, 2024
1a86fce
fix build error pertaining to the new throw in login page.tsx
ryandotfurrer Aug 29, 2024
68f5ac5
remove redundant setIsLoading(false) from try statement
ryandotfurrer Aug 30, 2024
edf7ccb
Merge branch 'develop' into ryan/create-input-loading-spinner
ryandotfurrer Sep 5, 2024
585c807
add `finally` statement to register page `onSubmit` function
ryandotfurrer Sep 5, 2024
564e8c4
Merge branch 'develop' into ryan/create-input-loading-spinner
ryandotfurrer Sep 5, 2024
cd6711d
Merge branch 'develop' into ryan/create-input-loading-spinner
ryandotfurrer Sep 19, 2024
6beef05
update login/page.test.tsx tests
ryandotfurrer Sep 19, 2024
a81040b
fix register page tests
ryandotfurrer Sep 20, 2024
f910e60
Merge branch 'develop' into ryan/create-input-loading-spinner
ryandotfurrer Sep 20, 2024
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
6 changes: 3 additions & 3 deletions app/(main)/league/all/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import { LeagueCard } from '@/components/LeagueCard/LeagueCard';
import { ILeague } from '@/api/apiFunctions.interface';
import { getUserLeagues } from '@/utils/utils';
import { useDataStore } from '@/store/dataStore';
import { getGameWeek } from '@/api/apiFunctions';
import LoadingSpinner from '@/components/LoadingSpinner/LoadingSpinner';
import { ENTRY_URL, LEAGUE_URL } from '@/const/global';

/**
Expand Down Expand Up @@ -56,9 +58,7 @@ const Leagues = (): JSX.Element => {
))
) : (
<div className="text-center">
<p className="text-lg font-bold">
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is incorrect. The loader should replace to submit content as the API is waiting for a response. This message is correct when there are 0 leagues associated with the user.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed from this page

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You reverted the

back, but the styles were not carried over.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shashilo what loader is meant to be used on the LeagueCard component? I thought this input spinner was for buttons only?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ryandotfurrer Was this question addressed?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<p className="text-lg font-bold"> These classes were removed. Wondering if this is intentional or not.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ryandotfurrer Was this question addressed?

It was not. @shashilo, what loader is meant to be used on the LeagueCard component? I thought this input spinner was for buttons only?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<p className="text-lg font-bold"> These classes were removed. Wondering if this is intentional or not.

These are back in and will be reflected upon the next commit.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ryandotfurrer Was this question addressed?

It was not. @shashilo, what loader is meant to be used on the LeagueCard component? I thought this input spinner was for buttons only?

@shashilo pinging you for a reminder, please advise.

You are not enrolled in any leagues
</p>
<LoadingSpinner height="max-h-32 h-32" />
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this max and hard set height?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added props to the loader so you can set the height of it to match the element it's replacing. I'll revise this so it takes up 100% of the height and width of what it's replacing by default

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shashilo This is outdated, can it be resolved?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shashilo pinging you for a reminder, please advise.

</div>
)}
</section>
Expand Down
2 changes: 1 addition & 1 deletion components/LeagueCard/LeagueCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const LeagueCard = React.forwardRef<HTMLAnchorElement, ILeagueCardProps>(
data-testid="LeagueCard"
href={href}
className={cn(
'LeagueCard flex max-h-32 place-items-center gap-6 rounded-lg border bg-card p-4 text-card-foreground shadow-sm dark:border-zinc-800 hover:bg-zinc-800 transition',
'LeagueCard flex max-h-32 h-32 place-items-center gap-6 rounded-lg border bg-card p-4 text-card-foreground shadow-sm dark:border-zinc-800',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DO NOT set a hard height on this component. This will remove its flexibility and create bugs when content overflows.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shashilo This is outdated, can it be resolved?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shashilo pinging you for a reminder, please advise.

)}
ref={ref}
>
Expand Down
41 changes: 41 additions & 0 deletions components/LoadingSpinner/LoadingSpinner.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Copyright (c) Gridiron Survivor.
// Licensed under the MIT License.

import React, { JSX } from 'react';
import { cn } from '@/utils/utils';

export interface ILoadingSpinnerProps {
height?: string;
width?: string;
}
/**
* Renders a loading spinner.
* @param {ILoadingSpinnerProps} props - The props for the loading spinner component.
* @param {string} props.height - The height of the loading spinner. This should be the same tailwind class as the element it is standing in for.
* @param {string} props.width - The width of the loading spinner. This should be the same tailwind class as the element it is standing in for.
* @returns {JSX.Element} The rendered loading spinner component.
*/
const LoadingSpinner = ({
height,
width,
}: ILoadingSpinnerProps): JSX.Element => {
return (
<div
role="alert"
tabIndex={-1}
className={cn(
'loading-spinner-container w-full h-full place-content-center text-center',
height,
width,
)}
>
<div
className="loading-spinner w-12 h-12 mx-auto rounded-full border-4 border-t-muted-foreground border-foreground animate-spin motion-reduces:hidden"
data-testid="loading-spinner"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this data-testid to the container

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in latest commit

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shashilo This is outdated, can it be resolved?

/>
<p className="sr-only motion-reduce:not-sr-only">Loading</p>
</div>
);
};

export default LoadingSpinner;
Loading