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
497 B
TypeScript
Raw Normal View History

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