Reviewed-on: #397 Co-authored-by: miteruzo <miteruzo@naver.com> Co-committed-by: miteruzo <miteruzo@naver.com>
このコミットはPull リクエスト #397 でマージされました.
このコミットが含まれているのは:
@@ -0,0 +1,34 @@
|
||||
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'
|
||||
新しい課題から参照
ユーザをブロックする