feat: pulsate load icons

pull/3756/head
Laurynas Gadliauskas 2021-06-07 14:43:46 +03:00
parent 961f47e554
commit 9e52e0cb7a
5 changed files with 41 additions and 19 deletions

View File

@ -56,7 +56,7 @@ header {
color: var(--textPrimary) !important; color: var(--textPrimary) !important;
} }
.action:hover { .action:hover {
background-color: rgba(255, 255, 255, .1); background-color: rgba(255, 255, 255, .2);
} }
.action i { .action i {
color: var(--icon) !important; color: var(--icon) !important;
@ -77,7 +77,7 @@ nav > div {
color: var(--textPrimary) !important; color: var(--textPrimary) !important;
} }
.breadcrumbs a:hover { .breadcrumbs a:hover {
background-color: rgba(255, 255, 255, .1); background-color: rgba(255, 255, 255, .2);
} }
#listing .item { #listing .item {
@ -212,3 +212,15 @@ table th {
.share__box__element { .share__box__element {
border-top-color: var(--divider); border-top-color: var(--divider);
} }
@keyframes pulse {
0% {
background-color: rgba(0, 0, 0, 0);
}
50% {
background-color: rgba(255, 255, 255, .2);
}
100% {
background-color: rgba(0, 0, 0, 0);
}
}

View File

@ -16,7 +16,6 @@
/> />
<button <button
:disabled="loading"
v-for="(ext, format) in formats" v-for="(ext, format) in formats"
:key="format" :key="format"
class="button button--block" class="button button--block"
@ -33,13 +32,13 @@
import { mapState, mapGetters } from "vuex"; import { mapState, mapGetters } from "vuex";
import { files as api } from "@/api"; import { files as api } from "@/api";
import url from "@/utils/url"; import url from "@/utils/url";
import buttons from "@/utils/buttons";
export default { export default {
name: "archive", name: "archive",
data: function () { data: function () {
return { return {
name: "", name: "",
loading: false,
formats: { formats: {
zip: "zip", zip: "zip",
tar: "tar", tar: "tar",
@ -76,17 +75,15 @@ export default {
uri = uri.replace("//", "/"); uri = uri.replace("//", "/");
try { try {
this.loading = true; buttons.loading("archive");
this.$store.commit("closeHovers");
await api.archive(uri, this.name, format, ...items); await api.archive(uri, this.name, format, ...items);
this.$store.commit("setReload", true); this.$store.commit("setReload", true);
} catch (e) { } catch (e) {
this.$showError(e); this.$showError(e);
} finally { } finally {
this.loading = false; buttons.done("archive");
} }
this.$store.commit("closeHovers");
}, },
}, },
}; };

View File

@ -30,7 +30,6 @@
type="submit" type="submit"
:aria-label="$t('buttons.unarchive')" :aria-label="$t('buttons.unarchive')"
:title="$t('buttons.unarchive')" :title="$t('buttons.unarchive')"
:disabled="loading"
> >
{{ $t("buttons.unarchive") }} {{ $t("buttons.unarchive") }}
</button> </button>
@ -41,12 +40,12 @@
<script> <script>
import { mapState, mapGetters } from "vuex"; import { mapState, mapGetters } from "vuex";
import { files as api } from "@/api"; import { files as api } from "@/api";
import buttons from "@/utils/buttons";
export default { export default {
name: "rename", name: "rename",
data: function () { data: function () {
return { return {
loading: false,
name: "", name: "",
}; };
}, },
@ -65,17 +64,15 @@ export default {
dst = dst.replace("//", "/"); dst = dst.replace("//", "/");
try { try {
this.loading = true; buttons.loading("unarchive");
this.$store.commit("closeHovers");
await api.unarchive(item.url, dst, false); await api.unarchive(item.url, dst, false);
this.$store.commit("setReload", true); this.$store.commit("setReload", true);
} catch (e) { } catch (e) {
this.$showError(e); this.$showError(e);
} finally { } finally {
this.loading = true; buttons.done("unarchive");
} }
this.$store.commit("closeHovers");
}, },
}, },
}; };

View File

@ -40,7 +40,23 @@ video {
} }
i.spin { i.spin {
animation: 1s spin linear infinite; animation: 1s spin linear infinite, 1s pulse linear infinite;
}
i.pulse-spin {
animation: 1s spin linear infinite, 1s pulse linear infinite;
}
@keyframes pulse {
0% {
background-color: rgba(0, 0, 0, 0);
}
50% {
background-color: rgba(0, 0, 0, .1);
}
100% {
background-color: rgba(0, 0, 0, 0);
}
} }
#app { #app {

View File

@ -14,7 +14,7 @@ function loading(button) {
el.style.opacity = 0; el.style.opacity = 0;
setTimeout(() => { setTimeout(() => {
el.classList.add("spin"); el.classList.add("pulse-spin");
el.innerHTML = "autorenew"; el.innerHTML = "autorenew";
el.style.opacity = 1; el.style.opacity = 1;
}, 100); }, 100);
@ -31,7 +31,7 @@ function done(button) {
el.style.opacity = 0; el.style.opacity = 0;
setTimeout(() => { setTimeout(() => {
el.classList.remove("spin"); el.classList.remove("pulse-spin");
el.innerHTML = el.dataset.icon; el.innerHTML = el.dataset.icon;
el.style.opacity = 1; el.style.opacity = 1;
}, 100); }, 100);