Skip to content

Commit

Permalink
feat: add skeleton loader for course description + distribution (#267)
Browse files Browse the repository at this point in the history
* feat: add skeleton loading for course description

* feat: added to distribution
  • Loading branch information
sghsri authored Oct 5, 2024
1 parent 08652c4 commit c2cab40
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
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

0 comments on commit c2cab40

Please sign in to comment.