Skip to content

Commit 0db4bbc

Browse files
committed
Loading spinner between verify page steps
1 parent ee9c474 commit 0db4bbc

File tree

3 files changed

+50
-3
lines changed

3 files changed

+50
-3
lines changed

app.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,12 @@ document.querySelectorAll('[data-step]').forEach(element => {
3030
if(activeMenuLi) activeMenuLi.classList.toggle('active', false);
3131
document.querySelector('#wizard>menu').classList.toggle('hidden', !thisMenuLi);
3232
thisMenuLi && thisMenuLi.classList.toggle('active', true);
33-
document.querySelectorAll('#wizard>main').forEach(el =>
34-
el.classList.toggle('hidden', el.id === step ? false : true));
33+
function showMain(step) {
34+
document.querySelectorAll('#wizard>main').forEach(el =>
35+
el.classList.toggle('hidden', el.id === step ? false : true));
36+
}
37+
showMain('loading');
38+
setTimeout(() => showMain(step), 900);
3539
}, true);
3640
});
3741

style.css

+39-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
body {background:#ddd; color:#222; font-family:Inter, sans-serif; min-height:100vh; margin:0; padding:0; overflow-x:hidden; max-width:100vw;display:flex;flex-direction:column;}
99
article {padding:30px 10px; }
1010
#wizard {max-width:720px; padding:0; margin:auto 10px; align-self:center; background:#eee; color:#222; border-radius: 10px 10px 0 0; box-shadow: 0 0 30px #000; }
11-
#wizard h1 {background:linear-gradient(180deg, #dbdbdb 0%, #d6d6d6 100%); border-width:1px 0; border-style:solid; border-color:#e8e8e8 #000 #a7a7a7 #000; margin:0; padding: 14px 0; font-size: 100%; text-align:center; border-radius: 10px 10px 0 0;}
11+
#wizard h1 {background:linear-gradient(180deg, #dbdbdb 0%, #d6d6d6 100%); border-width:1px 0; border-style:solid; border-color:#e8e8e8 #000 #a7a7a7 #000; margin:0; padding: 14px; font-size: 100%; text-align:center; border-radius: 10px 10px 0 0;}
1212
#wizard menu {margin:0; padding:0 10px; list-style:none; display:flex; background:#c8c8c8; border-bottom:1px solid #9b9b9b;}
1313
@media (max-width:450px) { #wizard menu {flex-direction:column;} }
1414
#wizard menu li { border-bottom: 4px solid #0000; flex:1; text-align:center; padding: 10px; white-space:nowrap; }
@@ -69,3 +69,41 @@ article.page { max-width:720px; margin:0 auto; }
6969
#grey-banner article { background-image:url(images/collage.png); background-size:contain; background-position:top right; background-repeat: no-repeat no-repeat; min-height:300px; color:#111; margin-bottom:20px; }
7070

7171

72+
.loader { text-align:center;}
73+
74+
.lds-ring {
75+
display: inline-block;
76+
position: relative;
77+
width: 80px;
78+
height: 80px;
79+
}
80+
.lds-ring div {
81+
box-sizing: border-box;
82+
display: block;
83+
position: absolute;
84+
width: 64px;
85+
height: 64px;
86+
margin: 8px;
87+
border: 8px solid #666;
88+
border-radius: 50%;
89+
animation: lds-ring 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
90+
border-color: #666 transparent transparent transparent;
91+
}
92+
.lds-ring div:nth-child(1) {
93+
animation-delay: -0.45s;
94+
}
95+
.lds-ring div:nth-child(2) {
96+
animation-delay: -0.3s;
97+
}
98+
.lds-ring div:nth-child(3) {
99+
animation-delay: -0.15s;
100+
}
101+
@keyframes lds-ring {
102+
0% {
103+
transform: rotate(0deg);
104+
}
105+
100% {
106+
transform: rotate(360deg);
107+
}
108+
}
109+

verify.html

+5
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,11 @@ <h1>Coinpassport Verification</h1>
8686
<li rel="step2">2. Scan Document</li>
8787
<li rel="step3">3. Publish Result</li>
8888
</menu>
89+
<main id="loading" class="hidden">
90+
<div class="loader">
91+
<div class="lds-ring"><div></div><div></div><div></div><div></div></div>
92+
</div>
93+
</main>
8994
<main id="step1">
9095
<p>Document verification costs 3 USDC.</p>
9196
<p>Please approve and pay this amount.</p>

0 commit comments

Comments
 (0)