fix(ui): 完整遵守减少动态效果偏好
This commit is contained in:
@@ -16,7 +16,7 @@ export function MotionHeader({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<motion.header
|
<motion.header
|
||||||
initial={{ opacity: 0, y: shouldReduceMotion ? 0 : 10 }}
|
initial={shouldReduceMotion ? false : { opacity: 0, y: 10 }}
|
||||||
animate={{ opacity: 1, y: 0 }}
|
animate={{ opacity: 1, y: 0 }}
|
||||||
transition={{ duration: 0.5, delay, ease: [0.25, 0.1, 0.25, 1] }}
|
transition={{ duration: 0.5, delay, ease: [0.25, 0.1, 0.25, 1] }}
|
||||||
className={className}
|
className={className}
|
||||||
@@ -37,7 +37,7 @@ export function MotionSection({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<motion.section
|
<motion.section
|
||||||
initial={{ opacity: 0, y: shouldReduceMotion ? 0 : 10 }}
|
initial={shouldReduceMotion ? false : { opacity: 0, y: 10 }}
|
||||||
animate={{ opacity: 1, y: 0 }}
|
animate={{ opacity: 1, y: 0 }}
|
||||||
transition={{ duration: 0.5, delay, ease: [0.25, 0.1, 0.25, 1] }}
|
transition={{ duration: 0.5, delay, ease: [0.25, 0.1, 0.25, 1] }}
|
||||||
className={className}
|
className={className}
|
||||||
@@ -58,7 +58,7 @@ export function MotionDiv({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<motion.div
|
<motion.div
|
||||||
initial={{ opacity: 0, y: shouldReduceMotion ? 0 : 10 }}
|
initial={shouldReduceMotion ? false : { opacity: 0, y: 10 }}
|
||||||
animate={{ opacity: 1, y: 0 }}
|
animate={{ opacity: 1, y: 0 }}
|
||||||
transition={{ duration: 0.5, delay, ease: [0.25, 0.1, 0.25, 1] }}
|
transition={{ duration: 0.5, delay, ease: [0.25, 0.1, 0.25, 1] }}
|
||||||
className={className}
|
className={className}
|
||||||
@@ -112,9 +112,11 @@ export function MotionTableRow({
|
|||||||
className,
|
className,
|
||||||
...props
|
...props
|
||||||
}: { children: ReactNode } & ComponentPropsWithoutRef<typeof motion.tr>) {
|
}: { children: ReactNode } & ComponentPropsWithoutRef<typeof motion.tr>) {
|
||||||
|
const { shouldReduceMotion } = useMotionConfig()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<motion.tr
|
<motion.tr
|
||||||
initial={{ opacity: 0 }}
|
initial={shouldReduceMotion ? false : { opacity: 0 }}
|
||||||
animate={{ opacity: 1 }}
|
animate={{ opacity: 1 }}
|
||||||
transition={{ duration: 0.3 }}
|
transition={{ duration: 0.3 }}
|
||||||
className={className}
|
className={className}
|
||||||
|
|||||||
Reference in New Issue
Block a user