Skip to content

Commit 0c78611

Browse files
committed
feat(component): refresh animation
1 parent 03cae70 commit 0c78611

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

packages/app-frontend/src/features/components/ComponentsInspector.vue

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,22 @@ export default defineComponent({
5959
6060
// Refresh
6161
62+
const animateRefresh = ref(false)
63+
let animateRefreshTimer
64+
6265
function refresh () {
6366
requestComponentTree(null)
6467
loadComponent(selectedComponentId.value)
68+
69+
// Animation
70+
animateRefresh.value = false
71+
clearTimeout(animateRefreshTimer)
72+
requestAnimationFrame(() => {
73+
animateRefresh.value = true
74+
animateRefreshTimer = setTimeout(() => {
75+
animateRefresh.value = false
76+
}, 1000)
77+
})
6578
}
6679
6780
// Scroller
@@ -77,6 +90,7 @@ export default defineComponent({
7790
startPickingComponent,
7891
stopPickingComponent,
7992
refresh,
93+
animateRefresh,
8094
treeScroller,
8195
}
8296
},
@@ -189,6 +203,9 @@ export default defineComponent({
189203
html: true
190204
}"
191205
class="icon-button flat"
206+
:class="{
207+
'animate-icon': animateRefresh,
208+
}"
192209
icon-left="refresh"
193210
@click="refresh()"
194211
/>
@@ -232,4 +249,16 @@ export default defineComponent({
232249
}
233250
}
234251
}
252+
253+
.animate-icon {
254+
>>> .vue-ui-icon {
255+
animation: refresh 1s ease-out;
256+
}
257+
}
258+
259+
@keyframes refresh {
260+
100% {
261+
transform: rotate(360deg);
262+
}
263+
}
235264
</style>

0 commit comments

Comments
 (0)