Skip to content

Commit

Permalink
feat: make skeletons rounded, only display them after 400ms (#1402)
Browse files Browse the repository at this point in the history
  • Loading branch information
MiniDigger committed Aug 18, 2024
1 parent bedd811 commit 2fd7b23
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
11 changes: 10 additions & 1 deletion frontend/src/components/Skeleton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
5 changes: 4 additions & 1 deletion frontend/src/pages/[user]/[project]/versions/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2fd7b23

Please sign in to comment.