Skip to content

Commit b6bff50

Browse files
fix: keep Buy me a coffin pill sticky on every page
The earlier scroll-reveal threshold (180px) hid the pill on short pages — most subpages (/about, /faq, /legal, /pricing) don't have enough content to scroll past it, so the pill never appeared there. Removes the scroll listener and renders the pill in its visible state immediately on mount. The existing fade-up CSS animation gives it a smooth entrance, and it now stays visible across every route.
1 parent 6a0d9c9 commit b6bff50

1 file changed

Lines changed: 1 addition & 17 deletions

File tree

src/components/CoffinPill.tsx

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,16 @@
11
'use client'
22

3-
import { useEffect, useState } from 'react'
43
import { track } from '@vercel/analytics'
54

6-
const REVEAL_AT = 180 // px scrolled before the pill fades in
7-
85
export default function CoffinPill() {
9-
const [visible, setVisible] = useState(false)
10-
11-
useEffect(() => {
12-
function handleScroll() {
13-
setVisible(window.scrollY > REVEAL_AT)
14-
}
15-
handleScroll()
16-
window.addEventListener('scroll', handleScroll, { passive: true })
17-
return () => window.removeEventListener('scroll', handleScroll)
18-
}, [])
19-
206
return (
217
<a
228
href="https://buymeacoffee.com/dotdevs"
239
target="_blank"
2410
rel="noopener noreferrer"
2511
aria-label="Buy me a coffin: support the morgue"
26-
aria-hidden={!visible}
27-
tabIndex={visible ? 0 : -1}
2812
onClick={() => track('buy_me_a_coffin_clicked', { from: 'top_right_pill' })}
29-
className={`coffin-pill${visible ? ' coffin-pill--visible' : ''}`}
13+
className="coffin-pill coffin-pill--visible"
3014
>
3115
<span aria-hidden style={{ fontSize: '13px', lineHeight: 1 }}></span>
3216
<span className="coffin-pill-text">Buy me a coffin</span>

0 commit comments

Comments
 (0)