Skip to content

Commit 0e034fc

Browse files
committed
preloader
1 parent 3c47cc4 commit 0e034fc

File tree

4 files changed

+78
-12
lines changed

4 files changed

+78
-12
lines changed

src/App.tsx

+1-3
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ const MainPageContent = React.lazy(() => import('./components/MainPageContent/Ma
2626
const Footer = React.lazy(() => import('./components/Footer/Footer'));
2727

2828

29-
3029
function App() {
3130
const [selectedArticle, setSelectedArticle] = useState<number>(0)
3231
const [selectedSubArticle, setSelectedSubArticle] = useState<null | number>(null);
@@ -94,7 +93,6 @@ function App() {
9493
}, [allAnswerIsCorrect, selectedArticle, allAnswerIsCorrectFunc]);
9594

9695

97-
9896
useEffect(() => {
9997
if (selectedSubArticle !== null) {
10098
const selectedSubArticleTest = data.historyList[selectedArticle]?.subtopics?.[selectedSubArticle]?.subArticleTest;
@@ -233,7 +231,7 @@ function App() {
233231
lessonsVisited={7}
234232
username={currentUser ? currentUser.name : "Петро" +
235233
" Сагайдачний"}/>
236-
:<Preloader/>
234+
: <Preloader/>
237235
}
238236
</React.Suspense>}
239237
/>

src/components/Preloader/Preloader.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import React from 'react';
2+
import "./preloader.scss"
23

34
const Preloader = () => {
45
return (
5-
<div style={{position: "fixed",}} className="preloader_bg">
6-
<div>Loading...</div>
6+
<div className="preloader_bg">
7+
<div className="loader"></div>
78
</div>
89
);
910
};
+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
.preloader_bg {
2+
position: fixed;
3+
left: 0;
4+
top: 0;
5+
width: 100%;
6+
height: 100%;
7+
background: rgba(0,0,0,.9);
8+
z-index: 2;
9+
}
10+
11+
.loader {
12+
width: 50px;
13+
aspect-ratio: 1;
14+
color: #5ad2e1;
15+
animation: l40 .5s infinite alternate;
16+
position: absolute;
17+
margin: auto;
18+
left: 0;
19+
right: 0;
20+
top: 0;
21+
bottom: 0;
22+
}
23+
24+
.loader:before,
25+
.loader:after {
26+
content: "";
27+
position: absolute;
28+
inset: 0;
29+
background-size: 25px 25px;
30+
background-position: 0 0, 100% 0, 100% 100%, 0 100%;
31+
background-repeat: no-repeat;
32+
}
33+
34+
.loader:before {
35+
background-image: radial-gradient(farthest-side at top left, currentColor 96%, #0000),
36+
radial-gradient(farthest-side at top right, currentColor 96%, #0000),
37+
radial-gradient(farthest-side at bottom right, currentColor 96%, #0000),
38+
radial-gradient(farthest-side at bottom left, currentColor 96%, #0000);
39+
animation: l40-1 1s infinite;
40+
}
41+
42+
.loader:after {
43+
background-image: radial-gradient(farthest-side at top left, #0000 94%, currentColor 96%),
44+
radial-gradient(farthest-side at top right, #0000 94%, currentColor 96%),
45+
radial-gradient(farthest-side at bottom right, #0000 94%, currentColor 96%),
46+
radial-gradient(farthest-side at bottom left, #0000 94%, currentColor 96%);
47+
animation: l40-2 1s infinite;
48+
}
49+
50+
@keyframes l40-1 {
51+
0%, 10%, 90%, 100% {
52+
inset: 0
53+
}
54+
40%, 60% {
55+
inset: -10px
56+
}
57+
}
58+
59+
@keyframes l40-2 {
60+
0%, 40% {
61+
transform: rotate(0)
62+
}
63+
60%, 100% {
64+
transform: rotate(90deg)
65+
}
66+
}

src/static/style/main.scss

+8-7
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,13 @@ main .MuiLinearProgress-root {
2525
border-radius: 4px;
2626
}
2727

28-
.preloader_bg {
29-
position: fixed;
30-
left: 0;
31-
top: 0;
32-
width: 100%;
28+
html, body, #root,.App {
3329
height: 100%;
34-
background: #000000ba;
35-
z-index: 2;
3630
}
31+
32+
.App {
33+
display: flex;
34+
flex-direction: column;
35+
}
36+
37+
footer { margin-top: auto }

0 commit comments

Comments
 (0)