blob: 20b4ca1129e51d420b909bb3f0f3e01765b99375 (
plain)
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
|
import React from "react";
import LinearProgress from "@material-ui/core/LinearProgress";
import Fade from "@material-ui/core/Fade";
export default function LoadingBar({ loading, height, children }) {
const dimOnTrue = (flag) => {
return {
opacity: flag ? 0.15 : 1,
height: "100%",
};
};
return (
<div style={{ height: height }}>
<Fade
in={loading}
style={{ transitionDelay: loading ? "300ms" : "0ms" }}
unmountOnExit
>
<LinearProgress />
</Fade>
<div style={dimOnTrue(loading)}>{children}</div>
</div>
);
}
|