Skip to content

Commit 9b7412c

Browse files
committed
feat: searching animation and transition
1 parent c39d591 commit 9b7412c

1 file changed

Lines changed: 57 additions & 11 deletions

File tree

app/pages/package/[[org]]/[name]/versions.vue

Lines changed: 57 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -362,17 +362,27 @@ const selectedChangelogContent = computed(() => {
362362
<span
363363
class="w-4 h-4 flex items-center justify-center text-fg-subtle shrink-0"
364364
>
365-
<span
366-
v-if="loadingGroup === item.groupKey"
367-
class="i-svg-spinners:ring-resize w-3 h-3"
368-
aria-hidden="true"
369-
/>
370-
<span
371-
v-else
372-
class="i-lucide:chevron-right w-3 h-3 transition-transform duration-200 rtl-flip"
373-
:class="expandedGroups.has(item.groupKey) ? 'rotate-90' : ''"
374-
aria-hidden="true"
375-
/>
365+
<Transition name="icon-swap" mode="out-in">
366+
<span
367+
v-if="loadingGroup === item.groupKey"
368+
key="loading"
369+
class="i-svg-spinners:ring-resize w-3 h-3"
370+
aria-hidden="true"
371+
/>
372+
<span
373+
v-else-if="isFilterActive"
374+
key="search"
375+
class="i-lucide:search w-3 h-3 animate-searching"
376+
aria-hidden="true"
377+
/>
378+
<span
379+
v-else
380+
key="chevron"
381+
class="i-lucide:chevron-right w-3 h-3 transition-transform duration-200 rtl-flip"
382+
:class="expandedGroups.has(item.groupKey) ? 'rotate-90' : ''"
383+
aria-hidden="true"
384+
/>
385+
</Transition>
376386
</span>
377387
<span class="text-sm font-medium">{{ item.label }}</span>
378388
<span class="text-xs text-fg-subtle">({{ item.versions.length }})</span>
@@ -574,6 +584,42 @@ const selectedChangelogContent = computed(() => {
574584
</template>
575585

576586
<style scoped>
587+
.icon-swap-enter-active {
588+
transition:
589+
opacity 0.15s ease,
590+
transform 0.15s ease;
591+
}
592+
593+
.icon-swap-leave-active {
594+
transition:
595+
opacity 0.15s ease,
596+
transform 0.15s ease;
597+
animation: none !important;
598+
}
599+
600+
.icon-swap-enter-from {
601+
opacity: 0;
602+
transform: scale(0.5);
603+
}
604+
605+
.icon-swap-leave-to {
606+
opacity: 0;
607+
transform: scale(0.5);
608+
}
609+
610+
@keyframes searching {
611+
from {
612+
transform: rotate(0deg) translateY(-2px) rotate(0deg);
613+
}
614+
to {
615+
transform: rotate(360deg) translateY(-2px) rotate(-360deg);
616+
}
617+
}
618+
619+
.animate-searching {
620+
animation: searching 1.2s linear infinite;
621+
}
622+
577623
.changelog-body {
578624
color: var(--fg-muted);
579625
line-height: 1.6;

0 commit comments

Comments
 (0)