Implement a loader animation

This commit is contained in:
Jeremy Dormitzer 2018-01-18 21:47:35 -05:00
parent f72e4349f4
commit d8f42b461c
No known key found for this signature in database
GPG Key ID: 04F17C0F5A32C320
3 changed files with 59 additions and 1 deletions

View File

@ -294,3 +294,56 @@ html, body {
.iconButton:hover {
background-color: #d7d7db;
}
.spinner {
margin: 80px auto;
width: 50px;
height: 40px;
text-align: center;
font-size: 10px;
}
.spinner > div {
background-color: #b1b1b3;
height: 100%;
width: 6px;
margin: 0 1px 0 1px;
display: inline-block;
-webkit-animation: sk-stretchdelay 1.2s infinite ease-in-out;
animation: sk-stretchdelay 1.2s infinite ease-in-out;
}
.spinner .rect2 {
-webkit-animation-delay: -1.1s;
animation-delay: -1.1s;
}
.spinner .rect3 {
-webkit-animation-delay: -1.0s;
animation-delay: -1.0s;
}
.spinner .rect4 {
-webkit-animation-delay: -0.9s;
animation-delay: -0.9s;
}
.spinner .rect5 {
-webkit-animation-delay: -0.8s;
animation-delay: -0.8s;
}
@-webkit-keyframes sk-stretchdelay {
0%, 40%, 100% { -webkit-transform: scaleY(0.4) }
20% { -webkit-transform: scaleY(1.0) }
}
@keyframes sk-stretchdelay {
0%, 40%, 100% {
transform: scaleY(0.4);
-webkit-transform: scaleY(0.4);
} 20% {
transform: scaleY(1.0);
-webkit-transform: scaleY(1.0);
}
}

View File

@ -4,3 +4,8 @@
(defn card [& children]
(apply dom/createDom "div" "card" children))
(defn loader []
(apply dom/createDom "div" "spinner"
(for [i (range 1 6)]
(dom/createDom "div" (str "rect" i)))))

View File

@ -81,8 +81,8 @@
[dispatch-message state]
(log/debug state)
(if (:loading state)
"Loading..."
(let [current-item (get-in-items (:items state) (:depth state))]
(components/loader)
(if (> (count current-item) 1)
(map #(components/card (:title %)) current-item)
()))))