chore(app): drawer honours prefers-reduced-motion; chore(memory): BDR-041, LRN-047, journal, TODO 7.x
This commit is contained in:
1 parent
552733b4c8
commit
aeea1f2e9b
5 files changed
+31
-14
No files matched your search
@@ -1,6 +1,6 @@
|
||||
import { useEffect } from 'react'
|
||||
import { Link } from 'react-router-dom'
|
||||
import { AnimatePresence, motion } from 'motion/react'
|
||||
import { AnimatePresence, motion, useReducedMotion } from 'motion/react'
|
||||
import Brand from '@/components/brand/Brand'
|
||||
import Icon from '@/components/ui/Icon'
|
||||
import SidebarNav from './SidebarNav'
|
||||
@@ -16,6 +16,8 @@ export interface MobileDrawerProps {
|
||||
/** Left-side navigation drawer for small screens (transform + opacity only). */
|
||||
export default function MobileDrawer({ open, onClose }: MobileDrawerProps) {
|
||||
const t = useT()
|
||||
const reduced = useReducedMotion()
|
||||
const slide = reduced ? { x: 0 } : { x: '-100%' }
|
||||
useEffect(() => {
|
||||
if (!open) return
|
||||
const onKey = (e: KeyboardEvent) => e.key === 'Escape' && onClose()
|
||||
@@ -40,10 +42,10 @@ export default function MobileDrawer({ open, onClose }: MobileDrawerProps) {
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
aria-label={t('shell.nav_label')}
|
||||
initial={{ x: '-100%' }}
|
||||
initial={slide}
|
||||
animate={{ x: 0 }}
|
||||
exit={{ x: '-100%' }}
|
||||
transition={{ duration: 0.2, ease: 'easeOut' }}
|
||||
exit={slide}
|
||||
transition={{ duration: reduced ? 0 : 0.2, ease: 'easeOut' }}
|
||||
className="absolute inset-y-0 left-0 flex w-[min(20rem,85vw)] flex-col bg-[var(--color-surface)] shadow-xl pt-[env(safe-area-inset-top)] pb-[env(safe-area-inset-bottom)]"
|
||||
>
|
||||
<div className="flex items-center justify-between px-4 py-3 border-b border-[var(--color-border)]">
|
||||
|
||||
Reference in new issue
Block a user