fix: make Shop's sliding filter pill respect prefers-reduced-motion

This commit is contained in:
belviskhoremk
2026-08-03 23:07:06 +00:00
parent 7cd84f1c66
commit 3f82e759cb

View File

@@ -1,5 +1,5 @@
import { useState } from 'react'
import { motion } from 'framer-motion'
import { motion, useReducedMotion } from 'framer-motion'
import ProductCard from '../components/ProductCard'
import InquiryModal from '../components/InquiryModal'
import { getProductsByCategory, type Product } from '../data/products'
@@ -10,6 +10,7 @@ const CATEGORIES: (Product['category'] | 'all')[] = ['all', 'hair-care', 'extens
function Shop() {
const [category, setCategory] = useState<Product['category'] | 'all'>('all')
const [inquiring, setInquiring] = useState<Product | null>(null)
const prefersReducedMotion = useReducedMotion()
return (
<div className={styles.page}>
@@ -26,7 +27,7 @@ function Shop() {
<motion.span
layoutId="active-filter-pill"
className={styles.activePill}
transition={{ type: 'spring', stiffness: 350, damping: 30 }}
transition={prefersReducedMotion ? { duration: 0 } : { type: 'spring', stiffness: 350, damping: 30 }}
/>
)}
<span className={styles.filterLabel}>{c.replace('-', ' ')}</span>