-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLoader.tsx
47 lines (40 loc) · 925 Bytes
/
Loader.tsx
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
"use client";
import { CSSProperties, useEffect, useState } from "react";
import { Hearts } from "react-loader-spinner";
const LoaderStyle: CSSProperties = {
position: "fixed",
top: "0",
left: "0",
width: "100%",
height: "100%",
display: "flex",
justifyContent: "center",
alignItems: "center",
backgroundColor: "#f1f5f9",
zIndex: 9999,
};
export const Loader = () => {
const [assetsLoaded, setAssetsLoaded] = useState(false);
useEffect(() => {
const timer = setTimeout(() => {
setAssetsLoaded(true);
}, 3000);
return () => clearTimeout(timer);
}, []);
if (!assetsLoaded) {
return (
<div style={LoaderStyle}>
<Hearts
height={80}
width={80}
color="#ef4444"
ariaLabel="hearts-loading"
wrapperStyle={{}}
wrapperClass=""
visible={true}
/>
</div>
);
}
return null;
};