2019-09-28 21:59:05 +00:00
|
|
|
import React, { Suspense } from 'react';
|
|
|
|
import Spinner from '@/components/elements/Spinner';
|
2020-07-04 22:40:41 +00:00
|
|
|
import tw from 'twin.macro';
|
2019-09-28 21:59:05 +00:00
|
|
|
|
2020-02-08 23:23:08 +00:00
|
|
|
const SuspenseSpinner = ({ children }: { children?: React.ReactNode }) => (
|
2019-09-28 21:59:05 +00:00
|
|
|
<Suspense
|
|
|
|
fallback={
|
2020-07-04 22:40:41 +00:00
|
|
|
<div css={tw`mx-4 w-3/4 mr-4 flex items-center justify-center`}>
|
2020-07-04 19:39:55 +00:00
|
|
|
<Spinner centered/>
|
2019-09-28 21:59:05 +00:00
|
|
|
</div>
|
|
|
|
}
|
|
|
|
>
|
|
|
|
{children}
|
|
|
|
</Suspense>
|
|
|
|
);
|
2020-02-08 23:23:08 +00:00
|
|
|
|
|
|
|
export default SuspenseSpinner;
|