Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,10 @@ function scrollToTop() {
contentContainer.value.scrollTo({ top: 0, behavior: 'smooth' })
}
}
const { y } = useScroll(contentContainer)
const isVisible = computed(() => {
return y.value > SCROLL_TO_TOP_THRESHOLD
})

// Canonical URL for this code page
const canonicalUrl = computed(() => `https://npmx.dev${getCodeUrl(route.params)}`)
Expand Down Expand Up @@ -459,6 +463,7 @@ defineOgImageComponent('Default', {
</div>
<div class="flex items-center gap-2">
<button
v-if="isVisible"
type="button"
class="px-2 py-1 font-mono text-xs text-fg-muted bg-bg-subtle border border-border rounded hover:text-fg hover:border-border-hover transition-colors items-center inline-flex gap-1"
@click="scrollToTop"
Expand Down
Loading