refactor: better icon button states

This commit is contained in:
liyasthomas
2021-06-29 17:04:02 +05:30
parent 729f341164
commit 9a83938c75
10 changed files with 99 additions and 146 deletions

View File

@@ -12,7 +12,7 @@
class="icon button"
@click="prettifyRequestBody"
>
<i class="material-icons">photo_filter</i>
<i class="material-icons">{{ prettifyIcon }}</i>
</button>
<label for="payload" class="p-0">
<button
@@ -69,7 +69,7 @@ export default {
},
data() {
return {
doneButton: '<i class="material-icons">done</i>',
prettifyIcon: "photo_filter",
}
},
computed: {
@@ -112,9 +112,8 @@ export default {
try {
const jsonObj = JSON.parse(this.rawParamsBody)
this.rawParamsBody = JSON.stringify(jsonObj, null, 2)
const oldIcon = this.$refs.prettifyRequest.innerHTML
this.$refs.prettifyRequest.innerHTML = this.doneButton
setTimeout(() => (this.$refs.prettifyRequest.innerHTML = oldIcon), 1000)
this.prettifyIcon = "done"
setTimeout(() => (this.prettifyIcon = "photo_filter"), 1000)
} catch (e) {
this.$toast.error(`${this.$t("json_prettify_invalid_body")}`, {
icon: "error",