Skip to content

Commit 5e0040b

Browse files
committed
fix: move downloads to separate line on mobile
1 parent 4111dac commit 5e0040b

1 file changed

Lines changed: 35 additions & 3 deletions

File tree

app/components/PackageCard.vue

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const emit = defineEmits<{
2323
class="group card-interactive scroll-mt-48 scroll-mb-6 relative focus-within:outline-none focus-within:ring-2 focus-within:ring-offset-bg focus-within:ring-offset-2 focus-within:ring-fg/50"
2424
:class="{ 'bg-bg-muted border-border-hover': selected }"
2525
>
26-
<div class="mb-2">
26+
<div class="mb-2 flex items-baseline justify-between gap-2">
2727
<component
2828
:is="headingLevel ?? 'h3'"
2929
class="font-mono text-sm sm:text-base font-medium text-fg group-hover:text-fg transition-colors duration-200 min-w-0 break-all"
@@ -39,6 +39,24 @@ const emit = defineEmits<{
3939
{{ result.package.name }}
4040
</NuxtLink>
4141
</component>
42+
<!-- Mobile: version next to package name -->
43+
<div class="sm:hidden text-fg-subtle flex items-center gap-1.5 shrink-0">
44+
<span
45+
v-if="result.package.version"
46+
class="font-mono text-xs truncate max-w-20"
47+
:title="result.package.version"
48+
>
49+
v{{ result.package.version }}
50+
</span>
51+
<ProvenanceBadge
52+
v-if="result.package.publisher?.trustedPublisher"
53+
:provider="result.package.publisher.trustedPublisher.id"
54+
:package-name="result.package.name"
55+
:version="result.package.version"
56+
:linked="false"
57+
compact
58+
/>
59+
</div>
4260
</div>
4361
<div class="flex justify-between items-start gap-4 sm:gap-8">
4462
<div class="min-w-0">
@@ -70,12 +88,26 @@ const emit = defineEmits<{
7088
</div>
7189
</dl>
7290
</div>
91+
<!-- Mobile: downloads on separate row -->
92+
<dl
93+
v-if="result.downloads?.weekly"
94+
class="sm:hidden flex items-center gap-4 mt-2 text-xs text-fg-subtle m-0"
95+
>
96+
<div class="flex items-center gap-1.5">
97+
<dt class="sr-only">Weekly downloads</dt>
98+
<dd class="flex items-center gap-1.5">
99+
<span class="i-carbon-chart-line w-3.5 h-3.5 inline-block" aria-hidden="true" />
100+
<span class="font-mono">{{ formatNumber(result.downloads.weekly) }}/w</span>
101+
</dd>
102+
</div>
103+
</dl>
73104
</div>
74-
<div class="flex flex-col gap-2 shrink-0">
105+
<!-- Desktop: version and downloads on right side -->
106+
<div class="hidden sm:flex flex-col gap-2 shrink-0">
75107
<div class="text-fg-subtle flex items-start gap-2 justify-end">
76108
<span
77109
v-if="result.package.version"
78-
class="font-mono text-xs truncate max-w-20 sm:max-w-32"
110+
class="font-mono text-xs truncate max-w-32"
79111
:title="result.package.version"
80112
>
81113
v{{ result.package.version }}

0 commit comments

Comments
 (0)