fix: keep current practice card visible
This commit is contained in:
@@ -224,7 +224,10 @@ export default function ProcessPurposePracticePage() {
|
||||
if (!deck) return
|
||||
|
||||
requestAnimationFrame(() => {
|
||||
const targetTop = Math.max(deck.scrollHeight - deck.clientHeight - 96, 0)
|
||||
const currentCard = deck.querySelector('[data-current-question="true"]') as HTMLElement | null
|
||||
if (!currentCard) return
|
||||
|
||||
const targetTop = Math.max(currentCard.offsetTop - 8, 0)
|
||||
deck.scrollTo({ top: targetTop, behavior: 'smooth' })
|
||||
})
|
||||
}, [progress.currentIndex])
|
||||
@@ -486,6 +489,7 @@ export default function ProcessPurposePracticePage() {
|
||||
}}
|
||||
exit={{ opacity: 0, y: -16, scale: 0.98 }}
|
||||
transition={{ duration: 0.22, ease: 'easeOut' }}
|
||||
data-current-question={isCurrent ? 'true' : undefined}
|
||||
className={`rounded-2xl border bg-white p-6 transition-all duration-200 dark:bg-gray-800 ${
|
||||
isCurrent && correctFeedback
|
||||
? 'border-green-300 shadow-lg shadow-green-100/70 ring-2 ring-green-100 dark:border-green-700 dark:shadow-none dark:ring-green-900/40'
|
||||
|
||||
Reference in New Issue
Block a user