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

feat: add skeleton loader for course description + distribution #267

Merged
merged 2 commits into from
Oct 5, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { CourseCatalogScraper } from '@views/lib/CourseCatalogScraper';
import { SiteSupport } from '@views/lib/getSiteSupport';
import clsx from 'clsx';
import React from 'react';
import Skeleton from 'react-loading-skeleton';

interface DescriptionProps {
course: Course;
Expand Down Expand Up @@ -60,8 +61,8 @@ export default function Description({ course }: DescriptionProps): JSX.Element {
Please refresh the page and log back in using your UT EID and password.
</Text>
)}
{/* TODO (achadaga): would be nice to have a new spinner here */}
{status === LoadStatus.LOADING && <Spinner />}
{status === LoadStatus.LOADING &&
Array.from({ length: 5 }).map((_, i) => <Skeleton style={{ marginBottom: 10 }} height={35} />)}
{status === LoadStatus.DONE && (
<ul className='ml-6 mt-1.5 list-disc list-outside space-y-1.5'>
{description.map(line => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import Highcharts from 'highcharts';
import HighchartsReact from 'highcharts-react-official';
import type { ChangeEvent } from 'react';
import React, { useEffect, useMemo, useRef, useState } from 'react';
import Skeleton from 'react-loading-skeleton';

interface GradeDistributionProps {
course: Course;
Expand Down Expand Up @@ -193,8 +194,7 @@ export default function GradeDistribution({ course }: GradeDistributionProps): J

return (
<div className='pt-3'>
{/* TODO (achadaga): again would be nice to have an updated spinner */}
{status === DataStatus.LOADING && <Spinner />}
{status === DataStatus.LOADING && <Skeleton height={300} />}
{status === DataStatus.NOT_FOUND && (
<HighchartsReact
ref={ref}
Expand Down
Loading