Make bottom sheet swipeable down to dismiss
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
2026-05-15 22:37:34 +02:00
parent a4014182a0
commit 26c5c119f0
2 changed files with 21 additions and 4 deletions
+4 -2
View File
@@ -118,9 +118,11 @@ body {
.sheet-handle { .sheet-handle {
width: 36px; width: 36px;
height: 4px; height: 4px;
background: #2e2e2e; background: #444;
border-radius: 2px; border-radius: 2px;
margin: 10px auto 0; margin: 0 auto;
padding: 16px 0;
background-clip: content-box;
} }
@keyframes slideUp { @keyframes slideUp {
from { transform: translateY(100%); } from { transform: translateY(100%); }
+17 -2
View File
@@ -219,8 +219,23 @@ function HomePage() {
{isMobile && expandedCard && ( {isMobile && expandedCard && (
<> <>
<div className="sheet-backdrop" onClick={() => setExpandedCardId(null)} /> <div className="sheet-backdrop" onClick={() => setExpandedCardId(null)} />
<div className="bottom-sheet"> <div
<div className="sheet-handle" /> className="bottom-sheet"
onTouchStart={e => { e._sheetStartY = e.touches[0].clientY; }}
onTouchMove={e => {
const dy = e.touches[0].clientY - e._sheetStartY;
if (dy > 0) e.currentTarget.style.transform = `translateY(${dy}px)`;
}}
onTouchEnd={e => {
const dy = e.changedTouches[0].clientY - e._sheetStartY;
if (dy > 80) {
setExpandedCardId(null);
} else {
e.currentTarget.style.transform = '';
}
}}
>
<div className="sheet-handle" style={{ cursor: 'grab' }} />
<div style={{ padding: '12px 16px', display: 'flex', flexDirection: 'column', alignItems: 'center', gap: '12px' }}> <div style={{ padding: '12px 16px', display: 'flex', flexDirection: 'column', alignItems: 'center', gap: '12px' }}>
{cardDetailContent(expandedCard)} {cardDetailContent(expandedCard)}
</div> </div>