import type { Transition } from 'framer-motion' import type { ClientAnimationMode } from '@/lib/settings' type ClientAnimationTransitionOptions = { normal: Transition reduced?: Transition off?: Transition } export const clientAnimationsOff = ( animationMode: ClientAnimationMode, ): boolean => animationMode === 'off' export const clientAnimationTransition = ( animationMode: ClientAnimationMode, { normal, reduced, off }: ClientAnimationTransitionOptions, ): Transition => { if (animationMode === 'off') return off ?? { duration: 0 } if (animationMode === 'reduced') return reduced ?? { duration: .08, ease: 'linear' as const } return normal } export const clientScrollBehaviour = ( animationMode: ClientAnimationMode, ): ScrollBehavior => animationMode === 'off' ? 'auto' : 'smooth'