Skip to content

Commit

Permalink
add loading
Browse files Browse the repository at this point in the history
  • Loading branch information
Xutaotaotao committed Apr 30, 2024
1 parent a7cd372 commit 0617fe6
Show file tree
Hide file tree
Showing 4 changed files with 120 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/.umi/testBrowser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export function TestBrowser(props: TestBrowserProps) {
routeComponents,
pluginManager,
rootElement: contextOpts.rootElement || document.getElementById('root'),
loadingComponent: Loading,
publicPath,
runtimePublicPath,
history,
Expand Down
2 changes: 2 additions & 0 deletions src/.umi/umi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { renderClient } from '/Users/xutaotao/Documents/s/XTools/node_modules/@u
import { getRoutes } from './core/route';
import { createPluginManager } from './core/plugin';
import { createHistory } from './core/history';
import Loading from '/Users/xutaotao/Documents/s/XTools/src/loading.tsx';
import { ApplyPluginsType } from 'umi';


Expand Down Expand Up @@ -51,6 +52,7 @@ async function render() {
routeComponents,
pluginManager,
rootElement: contextOpts.rootElement || document.getElementById('root'),
loadingComponent: Loading,
publicPath,
runtimePublicPath,
history,
Expand Down
103 changes: 103 additions & 0 deletions src/assets/loading.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
.three-body {
--uib-size: 35px;
--uib-speed: 0.8s;
--uib-color: #1677ff;
position: relative;
display: inline-block;
height: var(--uib-size);
width: var(--uib-size);
animation: spin78236 calc(var(--uib-speed) * 2.5) infinite linear;
}

.three-body__dot {
position: absolute;
height: 100%;
width: 30%;
}

.three-body__dot:after {
content: '';
position: absolute;
height: 0%;
width: 100%;
padding-bottom: 100%;
background-color: var(--uib-color);
border-radius: 50%;
}

.three-body__dot:nth-child(1) {
bottom: 5%;
left: 0;
transform: rotate(60deg);
transform-origin: 50% 85%;
}

.three-body__dot:nth-child(1)::after {
bottom: 0;
left: 0;
animation: wobble1 var(--uib-speed) infinite ease-in-out;
animation-delay: calc(var(--uib-speed) * -0.3);
}

.three-body__dot:nth-child(2) {
bottom: 5%;
right: 0;
transform: rotate(-60deg);
transform-origin: 50% 85%;
}

.three-body__dot:nth-child(2)::after {
bottom: 0;
left: 0;
animation: wobble1 var(--uib-speed) infinite
calc(var(--uib-speed) * -0.15) ease-in-out;
}

.three-body__dot:nth-child(3) {
bottom: -5%;
left: 0;
transform: translateX(116.666%);
}

.three-body__dot:nth-child(3)::after {
top: 0;
left: 0;
animation: wobble2 var(--uib-speed) infinite ease-in-out;
}

@keyframes spin78236 {
0% {
transform: rotate(0deg);
}

100% {
transform: rotate(360deg);
}
}

@keyframes wobble1 {
0%,
100% {
transform: translateY(0%) scale(1);
opacity: 1;
}

50% {
transform: translateY(-66%) scale(0.65);
opacity: 0.8;
}
}

@keyframes wobble2 {
0%,
100% {
transform: translateY(0%) scale(1);
opacity: 1;
}

50% {
transform: translateY(66%) scale(0.65);
opacity: 0.8;
}
}

14 changes: 14 additions & 0 deletions src/loading.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import "@/assets/loading.css";

const Loding = () => {
return (
<div style={{ display: "flex", justifyContent: "center", alignItems: "center",height:'80vh',width:'100%' }}>
<div className="three-body">
<div className="three-body__dot"></div>
<div className="three-body__dot"></div>
<div className="three-body__dot"></div>
</div>
</div>
);
};
export default Loding;

0 comments on commit 0617fe6

Please sign in to comment.