Skip to content

Commit f8951cb

Browse files
authored
Merge pull request #4883 from easyops-cn/fix/container-initial-loading-260820-1048
style(container): add animated initial loading
2 parents 052429b + 0bbcf80 commit f8951cb

2 files changed

Lines changed: 157 additions & 1 deletion

File tree

packages/brick-container/src/index.ejs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,22 @@
2222
<div id="main-mount-point"></div>
2323
<div id="legacy-iframe-mount-point"></div>
2424
</div>
25-
<div id="loading-bar-mount-point"><div class="global-loading-bar initial-loading-bar"><div></div></div></div>
25+
<div id="loading-bar-mount-point">
26+
<div class="global-loading-bar initial-loading-bar"><div></div></div>
27+
<div class="initial-loading-screen" role="status" aria-live="polite">
28+
<div class="initial-loading-content">
29+
<span class="initial-loading-spinner" aria-hidden="true">
30+
<i class="initial-loading-spinner-item"></i>
31+
<i class="initial-loading-spinner-item"></i>
32+
<i class="initial-loading-spinner-item"></i>
33+
<i class="initial-loading-spinner-item"></i>
34+
</span>
35+
<span class="initial-loading-text" aria-label="Loading">
36+
<span class="initial-loading-letter" aria-hidden="true">L</span><span class="initial-loading-letter" aria-hidden="true">o</span><span class="initial-loading-letter" aria-hidden="true">a</span><span class="initial-loading-letter" aria-hidden="true">d</span><span class="initial-loading-letter" aria-hidden="true">i</span><span class="initial-loading-letter" aria-hidden="true">n</span><span class="initial-loading-letter" aria-hidden="true">g</span>
37+
</span>
38+
</div>
39+
</div>
40+
</div>
2641
</div>
2742
<div id="bg-mount-point"></div>
2843
<div id="portal-mount-point"></div>

packages/brick-container/src/styles/default.css

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,114 @@ html[data-mode="dashboard"] body.has-sub-menu #main-mount-point {
140140
display: none;
141141
}
142142

143+
.initial-loading-screen {
144+
position: fixed;
145+
top: 0;
146+
right: 0;
147+
bottom: 0;
148+
left: 0;
149+
z-index: 9999;
150+
display: flex;
151+
align-items: center;
152+
justify-content: center;
153+
background: #f5f7fa;
154+
color: #595959;
155+
font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
156+
}
157+
158+
.initial-loading-content {
159+
display: flex;
160+
flex-direction: column;
161+
align-items: center;
162+
}
163+
164+
.initial-loading-spinner {
165+
position: relative;
166+
display: inline-block;
167+
width: 20px;
168+
height: 20px;
169+
font-size: 20px;
170+
transform: rotate(45deg);
171+
animation: initial-loading-spin 1.2s infinite linear;
172+
}
173+
174+
.initial-loading-spinner-item {
175+
position: absolute;
176+
display: block;
177+
width: 9px;
178+
height: 9px;
179+
background-color: #1890ff;
180+
border-radius: 100%;
181+
opacity: 0.3;
182+
transform: scale(0.75);
183+
transform-origin: 50% 50%;
184+
animation: initial-loading-dot 1s infinite linear alternate;
185+
}
186+
187+
.initial-loading-spinner-item:nth-child(1) {
188+
top: 0;
189+
left: 0;
190+
}
191+
192+
.initial-loading-spinner-item:nth-child(2) {
193+
top: 0;
194+
right: 0;
195+
animation-delay: 0.4s;
196+
}
197+
198+
.initial-loading-spinner-item:nth-child(3) {
199+
right: 0;
200+
bottom: 0;
201+
animation-delay: 0.8s;
202+
}
203+
204+
.initial-loading-spinner-item:nth-child(4) {
205+
bottom: 0;
206+
left: 0;
207+
animation-delay: 1.2s;
208+
}
209+
210+
.initial-loading-text {
211+
margin-top: 16px;
212+
color: #1890ff;
213+
}
214+
215+
.initial-loading-letter {
216+
display: inline-block;
217+
min-width: 0.55em;
218+
text-align: center;
219+
animation: initial-loading-letter-jump 1.4s ease-in-out infinite;
220+
}
221+
222+
.initial-loading-letter:nth-child(2) {
223+
animation-delay: 0.1s;
224+
}
225+
226+
.initial-loading-letter:nth-child(3) {
227+
animation-delay: 0.2s;
228+
}
229+
230+
.initial-loading-letter:nth-child(4) {
231+
animation-delay: 0.3s;
232+
}
233+
234+
.initial-loading-letter:nth-child(5) {
235+
animation-delay: 0.4s;
236+
}
237+
238+
.initial-loading-letter:nth-child(6) {
239+
animation-delay: 0.5s;
240+
}
241+
242+
.initial-loading-letter:nth-child(7) {
243+
animation-delay: 0.6s;
244+
}
245+
246+
.first-rendered .initial-loading-screen,
247+
.bootstrap-error .initial-loading-screen {
248+
display: none;
249+
}
250+
143251
@keyframes global-loading {
144252
from {
145253
transform: translateX(-30%) scaleX(0.3);
@@ -165,3 +273,36 @@ html[data-mode="dashboard"] body.has-sub-menu #main-mount-point {
165273
transform: translateX(120%);
166274
}
167275
}
276+
277+
@keyframes initial-loading-spin {
278+
to {
279+
transform: rotate(405deg);
280+
}
281+
}
282+
283+
@keyframes initial-loading-dot {
284+
to {
285+
opacity: 1;
286+
transform: scale(1);
287+
}
288+
}
289+
290+
@keyframes initial-loading-letter-jump {
291+
0%,
292+
40%,
293+
100% {
294+
transform: translateY(0);
295+
}
296+
297+
20% {
298+
transform: translateY(-5px);
299+
}
300+
}
301+
302+
@media (prefers-reduced-motion: reduce) {
303+
.initial-loading-spinner,
304+
.initial-loading-spinner-item,
305+
.initial-loading-letter {
306+
animation: none;
307+
}
308+
}

0 commit comments

Comments
 (0)