forked from rage/java-programming
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLoading.js
More file actions
32 lines (27 loc) · 728 Bytes
/
Loading.js
File metadata and controls
32 lines (27 loc) · 728 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import React, { Fragment } from "react"
import styled from "styled-components"
import { CircularProgress } from "@material-ui/core"
import withSimpleErrorBoundary from "../util/withSimpleErrorBoundary"
const LoadingWrapper = styled.div`
padding: 5rem;
display: flex;
align-items: center;
flex-direction: column;
width: 100%;
${props =>
props.heightHint &&
`
height: ${props.heightHint};
`}
`
const Loading = ({ children, loading = true, heightHint = "500px" }) => {
if (loading) {
return (
<LoadingWrapper heightHint={heightHint}>
<CircularProgress />
</LoadingWrapper>
)
}
return <Fragment>{children}</Fragment>
}
export default withSimpleErrorBoundary(Loading)