1
0
mirror of https://github.com/uetchy/namae.git synced 2025-03-20 05:50:32 +09:00
namae/web/src/util/suspense.tsx

23 lines
494 B
TypeScript
Raw Normal View History

2019-08-14 18:46:57 +09:00
import React, { Suspense } from 'react'
import styled from 'styled-components'
import BarLoader from 'react-spinners/BarLoader'
2019-09-01 01:28:24 +09:00
export const FullScreenSuspense: React.FC = ({ children }) => {
2019-08-14 18:46:57 +09:00
return <Suspense fallback={<Fallback />}>{children}</Suspense>
}
const Container = styled.div`
width: 100vw;
height: 100vh;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
`
const Fallback = () => (
<Container>
<BarLoader />
</Container>
)