File tree Expand file tree Collapse file tree
app/pages/package-code/[[org]]/[packageName]/v/[version] Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -256,6 +256,10 @@ function scrollToTop() {
256256 contentContainer .value .scrollTo ({ top: 0 , behavior: ' smooth' })
257257 }
258258}
259+ const { y } = useScroll (contentContainer )
260+ const isVisible = computed (() => {
261+ return y .value > SCROLL_TO_TOP_THRESHOLD
262+ })
259263
260264// Canonical URL for this code page
261265const canonicalUrl = computed (() => ` https://npmx.dev${getCodeUrl (route .params )} ` )
@@ -459,6 +463,7 @@ defineOgImageComponent('Default', {
459463 </div >
460464 <div class =" flex items-center gap-2" >
461465 <button
466+ v-if =" isVisible"
462467 type =" button"
463468 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"
464469 @click =" scrollToTop"
You can’t perform that action at this time.
0 commit comments