Add loading spinner while feed loads
This commit is contained in:
parent
8e06e4351e
commit
587e1e5d61
16
web/components/loading-indicator.tsx
Normal file
16
web/components/loading-indicator.tsx
Normal 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>
|
||||||
|
)
|
||||||
|
}
|
|
@ -16,6 +16,7 @@ import { getFollowedFolds, listAllFolds } from '../lib/firebase/folds'
|
||||||
import { Fold } from '../../common/fold'
|
import { Fold } from '../../common/fold'
|
||||||
import { filterDefined } from '../../common/util/array'
|
import { filterDefined } from '../../common/util/array'
|
||||||
import { useUserBets } from '../hooks/use-user-bets'
|
import { useUserBets } from '../hooks/use-user-bets'
|
||||||
|
import { LoadingIndicator } from '../components/loading-indicator'
|
||||||
|
|
||||||
export async function getStaticProps() {
|
export async function getStaticProps() {
|
||||||
const [contracts, folds] = await Promise.all([
|
const [contracts, folds] = await Promise.all([
|
||||||
|
@ -136,7 +137,9 @@ const Home = (props: { contracts: Contract[]; folds: Fold[] }) => {
|
||||||
contractBets={contractBets}
|
contractBets={contractBets}
|
||||||
contractComments={contractComments}
|
contractComments={contractComments}
|
||||||
/>
|
/>
|
||||||
) : null}
|
) : (
|
||||||
|
<LoadingIndicator className="mt-4" />
|
||||||
|
)}
|
||||||
</Col>
|
</Col>
|
||||||
</Col>
|
</Col>
|
||||||
</Page>
|
</Page>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user