feat: make skeletons rounded, only display them after 400ms (#1402)

This commit is contained in:
MiniDigger | Martin 2024-08-18 16:46:56 +02:00
parent bedd81159c
commit 2fd7b2348b
2 changed files with 14 additions and 2 deletions

View File

@ -7,10 +7,19 @@ withDefaults(
animated: true,
}
);
const show = ref(false);
if (import.meta.client) {
onMounted(() => {
setTimeout(() => {
show.value = true;
}, 400);
});
}
</script>
<template>
<div class="skeleton" :class="animated && 'skeleton--animated'">
<div v-show="show" class="skeleton rounded-md shadow-md" :class="animated && 'skeleton--animated'">
<div class="skeleton__content">Loading...</div>
</div>
</template>

View File

@ -92,7 +92,10 @@ function getVisibilityTitle(visibility: Visibility) {
<div ref="pageChangeScrollAnchor" class="flex flex-wrap md:flex-nowrap gap-4">
<section class="basis-full md:basis-11/15 flex-grow">
<ul>
<Skeleton v-if="versionsStatus === 'loading'" class="h-100" />
<template v-if="versionsStatus === 'loading'">
<Skeleton class="mb-2 h-[90px]" />
<Skeleton class="mb-2 h-[90px]" />
</template>
<Alert v-else-if="!versions?.result?.length" type="info"> {{ i18n.t("version.page.noVersions") }} </Alert>
<Pagination
v-else