Add loading spinner while feed loads

This commit is contained in:
James Grugett 2022-02-03 17:12:09 -06:00
parent 8e06e4351e
commit 587e1e5d61
2 changed files with 20 additions and 1 deletions

View File

@ -0,0 +1,16 @@
import clsx from 'clsx'
export function LoadingIndicator(props: { className?: string }) {
const { className } = props
return (
<div className={clsx('flex justify-center items-center', className)}>
<div
className="spinner-border animate-spin inline-block w-8 h-8 border-4 rounded-full text-indigo-500"
role="status"
>
<span className="visually-hidden">Loading...</span>
</div>
</div>
)
}

View File

@ -16,6 +16,7 @@ import { getFollowedFolds, listAllFolds } from '../lib/firebase/folds'
import { Fold } from '../../common/fold'
import { filterDefined } from '../../common/util/array'
import { useUserBets } from '../hooks/use-user-bets'
import { LoadingIndicator } from '../components/loading-indicator'
export async function getStaticProps() {
const [contracts, folds] = await Promise.all([
@ -136,7 +137,9 @@ const Home = (props: { contracts: Contract[]; folds: Fold[] }) => {
contractBets={contractBets}
contractComments={contractComments}
/>
) : null}
) : (
<LoadingIndicator className="mt-4" />
)}
</Col>
</Col>
</Page>