Skip to content

Commit

Permalink
[Refactor] loading spinner 컴포넌트 분리 및 fallbackText 추가 #1203
Browse files Browse the repository at this point in the history
  • Loading branch information
Clearsu committed Dec 22, 2023
1 parent 2bf417c commit 28a69e6
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,18 @@ import { instance } from 'utils/axios';
import { convertTournamentGamesToBracketMatchs } from 'utils/handleTournamentGame';
import { errorState } from 'utils/recoil/error';
import TournamentBraket from 'components/tournament/TournamentBraket';
import LoadingSpinner from 'components/UI/LoadingSpinner';
import useComponentSize from 'hooks/util/useComponentSize';
import styles from 'styles/tournament-record/UserTournamentBracket.module.scss';
import styles from 'styles/tournament/UserTournamentBracket.module.scss';

interface UserTournamentBracketProps {
tournamentId: number | undefined;
fallbackText?: string;
}

export default function UserTournamentBraket({
tournamentId,
fallbackText,
}: UserTournamentBracketProps) {
const setError = useSetRecoilState(errorState);
const [ref, size] = useComponentSize<HTMLDivElement>();
Expand Down Expand Up @@ -45,12 +48,14 @@ export default function UserTournamentBraket({
return (
<div ref={ref} className={styles.bracketContainer}>
{isLoading ? (
<div className={styles.loadingAnimation} />
) : (
<LoadingSpinner />
) : tournamentId ? (
<TournamentBraket
singleEliminationBracketMatchs={bracketMatches}
containerSize={size}
/>
) : (
<div className={styles.noTournamentText}>{fallbackText}</div>
)}
</div>
);
Expand Down

0 comments on commit 28a69e6

Please sign in to comment.