Skip to content

Commit 2b06802

Browse files
committed
step 0
1 parent c52d259 commit 2b06802

1 file changed

Lines changed: 46 additions & 35 deletions

File tree

app/components/Package/WeeklyDownloadStats.vue

Lines changed: 46 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ const config = computed<VueUiSparklineConfig>(() => {
264264
</script>
265265

266266
<template>
267-
<div class="space-y-8 h-[110px] motion-safe:h-[140px]">
267+
<div class="space-y-8 h-[110px]">
268268
<CollapsibleSection id="downloads" :title="$t('package.downloads.title')">
269269
<template #actions>
270270
<ButtonBase
@@ -282,46 +282,57 @@ const config = computed<VueUiSparklineConfig>(() => {
282282

283283
<div class="w-full overflow-hidden">
284284
<template v-if="isLoadingWeeklyDownloads || hasWeeklyDownloads">
285-
<ClientOnly>
286-
<VueUiSparkline class="w-full max-w-xs" :dataset :config>
287-
<template #skeleton>
288-
<!-- This empty div overrides the default built-in scanning animation on load -->
289-
<div />
290-
</template>
291-
</VueUiSparkline>
292-
<template #fallback>
293-
<!-- Skeleton matching VueUiSparkline layout (title 24px + SVG aspect 500:80) -->
294-
<div class="max-w-xs">
295-
<!-- Title row: fontSize * 2 = 24px -->
296-
<div class="h-6 flex items-center ps-3">
297-
<SkeletonInline class="h-3 w-36" />
298-
</div>
299-
<!-- Chart area: matches SVG viewBox 500:80 -->
300-
<div class="aspect-[500/80] flex items-center">
301-
<!-- Data label (covers ~42% width, matching dataLabel.offsetX) -->
302-
<div class="w-[42%] flex items-center ps-0.5">
303-
<SkeletonInline class="h-7 w-24" />
285+
<div class="relative">
286+
<ClientOnly>
287+
<VueUiSparkline class="w-full max-w-xs" :dataset :config>
288+
<template #skeleton>
289+
<!-- This empty div overrides the default built-in scanning animation on load -->
290+
<div />
291+
</template>
292+
</VueUiSparkline>
293+
<template #fallback>
294+
<!-- Skeleton matching VueUiSparkline layout (title 24px + SVG aspect 500:80) -->
295+
<div class="max-w-xs">
296+
<!-- Title row: fontSize * 2 = 24px -->
297+
<div class="h-6 flex items-center ps-3">
298+
<SkeletonInline class="h-3 w-36" />
304299
</div>
305-
<!-- Sparkline line placeholder -->
306-
<div class="flex-1 flex items-end pe-3">
307-
<SkeletonInline class="h-px w-full" />
300+
<!-- Chart area: matches SVG viewBox 500:80 -->
301+
<div class="aspect-[500/80] flex items-center">
302+
<!-- Data label (covers ~42% width, matching dataLabel.offsetX) -->
303+
<div class="w-[42%] flex items-center ps-0.5">
304+
<SkeletonInline class="h-7 w-24" />
305+
</div>
306+
<!-- Sparkline line placeholder -->
307+
<div class="flex-1 flex items-end pe-3">
308+
<SkeletonInline class="h-px w-full" />
309+
</div>
308310
</div>
309311
</div>
310-
<!-- Animation toggle placeholder -->
311-
<div class="w-full hidden motion-safe:flex flex-1 items-end justify-end">
312-
<SkeletonInline class="h-[20px] w-30" />
313-
</div>
314-
</div>
315-
</template>
316-
</ClientOnly>
317-
318-
<div v-if="hasWeeklyDownloads" class="hidden motion-safe:flex justify-end p-1">
319-
<ButtonBase size="small" @click="toggleSparklineAnimation">
320-
{{
312+
</template>
313+
</ClientOnly>
314+
315+
<ButtonBase
316+
v-if="hasWeeklyDownloads"
317+
type="button"
318+
size="small"
319+
class="hidden motion-safe:inline-flex absolute top-0 inset-ie-0 !p-1 !border-0 !bg-transparent hover:!bg-transparent text-fg-subtle hover:text-fg transition-colors duration-200 focus-visible:outline-accent/70 rounded"
320+
:title="
321321
hasSparklineAnimation
322322
? $t('package.trends.pause_animation')
323323
: $t('package.trends.play_animation')
324-
}}
324+
"
325+
:classicon="hasSparklineAnimation ? 'i-lucide:pause' : 'i-lucide:play'"
326+
:aria-pressed="hasSparklineAnimation"
327+
@click="toggleSparklineAnimation"
328+
>
329+
<span class="sr-only">
330+
{{
331+
hasSparklineAnimation
332+
? $t('package.trends.pause_animation')
333+
: $t('package.trends.play_animation')
334+
}}
335+
</span>
325336
</ButtonBase>
326337
</div>
327338
</template>

0 commit comments

Comments
 (0)