Skip to content

Commit 3932474

Browse files
committed
fix(ui): improve MetricsBadges skeleton alignment
1 parent 62cff37 commit 3932474

2 files changed

Lines changed: 20 additions & 18 deletions

File tree

app/components/Package/MetricsBadges.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@ const typesHref = computed(() => {
5454
<template>
5555
<ul v-if="analysis" class="flex items-center gap-1.5 list-none m-0 p-0">
5656
<!-- TypeScript types badge -->
57-
<li v-if="!props.isBinary">
57+
<li v-if="!props.isBinary" class="contents">
5858
<TooltipApp :text="typesTooltip">
5959
<component
6060
:is="typesHref ? NuxtLink : 'span'"
6161
:to="typesHref"
6262
:tabindex="!typesHref ? 0 : undefined"
63-
class="inline-flex items-center gap-1 px-1.5 py-0.5 font-mono text-xs rounded transition-colors duration-200 focus-visible:(outline-2 outline-accent)"
63+
class="flex items-center gap-1 px-1.5 py-0.5 font-mono text-xs rounded transition-colors duration-200 focus-visible:(outline-2 outline-accent)"
6464
:class="[
6565
hasTypes
6666
? 'text-fg-muted bg-bg-muted border border-border'
@@ -81,11 +81,11 @@ const typesHref = computed(() => {
8181
</li>
8282

8383
<!-- ESM badge (show with X if missing) -->
84-
<li>
84+
<li class="contents">
8585
<TooltipApp :text="hasEsm ? $t('package.metrics.esm') : $t('package.metrics.no_esm')">
8686
<span
8787
tabindex="0"
88-
class="inline-flex items-center gap-1 px-1.5 py-0.5 font-mono text-xs rounded transition-colors duration-200 focus-visible:(outline-2 outline-accent)"
88+
class="flex items-center gap-1 px-1.5 py-0.5 font-mono text-xs rounded transition-colors duration-200 focus-visible:(outline-2 outline-accent)"
8989
:class="
9090
hasEsm
9191
? 'text-fg-muted bg-bg-muted border border-border'
@@ -103,11 +103,11 @@ const typesHref = computed(() => {
103103
</li>
104104

105105
<!-- CJS badge (only show if present) -->
106-
<li v-if="hasCjs">
106+
<li v-if="hasCjs" class="contents">
107107
<TooltipApp :text="$t('package.metrics.cjs')">
108108
<span
109109
tabindex="0"
110-
class="inline-flex items-center gap-1 px-1.5 py-0.5 font-mono text-xs text-fg-muted bg-bg-muted border border-border rounded transition-colors duration-200 focus-visible:(outline-2 outline-accent)"
110+
class="flex items-center gap-1 px-1.5 py-0.5 font-mono text-xs text-fg-muted bg-bg-muted border border-border rounded transition-colors duration-200 focus-visible:(outline-2 outline-accent)"
111111
>
112112
<span class="i-carbon-checkmark w-3 h-3" aria-hidden="true" />
113113
CJS

app/pages/package/[...package].vue

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -541,8 +541,8 @@ defineOgImageComponent('Package', {
541541
</span>
542542

543543
<!-- Package metrics (module format, types) -->
544-
<ClientOnly>
545-
<div class="flex gap-2 sm:gap-3 flex-wrap">
544+
<div class="flex gap-2 sm:gap-3 flex-wrap">
545+
<ClientOnly>
546546
<PackageMetricsBadges
547547
v-if="resolvedVersion"
548548
:package-name="pkg.name"
@@ -569,16 +569,18 @@ defineOgImageComponent('Package', {
569569
/>
570570
<span>{{ formatCompactNumber(likesData?.totalLikes ?? 0, { decimals: 1 }) }}</span>
571571
</button>
572-
</div>
573-
574-
<template #fallback>
575-
<div class="flex items-center gap-1.5 self-baseline ms-1 sm:ms-2">
576-
<SkeletonBlock class="w-8 h-5 rounded" />
577-
<SkeletonBlock class="w-12 h-5 rounded" />
578-
<SkeletonBlock class="w-5 h-5 rounded" />
579-
</div>
580-
</template>
581-
</ClientOnly>
572+
<template #fallback>
573+
<div
574+
class="flex items-center gap-1.5 list-none m-0 p-0 relative top-[5px] self-baseline ms-1 sm:ms-2"
575+
>
576+
<SkeletonBlock class="w-16 h-5.5 rounded" />
577+
<SkeletonBlock class="w-13 h-5.5 rounded" />
578+
<SkeletonBlock class="w-13 h-5.5 rounded" />
579+
<div class="w-13 h5.5" />
580+
</div>
581+
</template>
582+
</ClientOnly>
583+
</div>
582584

583585
<!-- Internal navigation: Docs + Code + Compare (hidden on mobile, shown in external links instead) -->
584586
<nav

0 commit comments

Comments
 (0)