chore: native-like draggable mobile menus (#2599)
This commit is contained in:
@@ -17,9 +17,6 @@ const Animations = {
|
||||
},
|
||||
exit: {
|
||||
keyframes: [
|
||||
{
|
||||
transform: 'translateY(0)',
|
||||
},
|
||||
{
|
||||
transform: 'translateY(100%)',
|
||||
},
|
||||
@@ -81,11 +78,11 @@ const Animations = {
|
||||
},
|
||||
}
|
||||
|
||||
const MobileOptions = {
|
||||
export const MobileModalAnimationOptions = {
|
||||
easing: IosModalAnimationEasing,
|
||||
duration: 250,
|
||||
fill: 'forwards',
|
||||
}
|
||||
} as const
|
||||
|
||||
const NonMobileOptions = {
|
||||
duration: 75,
|
||||
@@ -102,7 +99,7 @@ export const useModalAnimation = (
|
||||
open: isOpen,
|
||||
enter: {
|
||||
keyframes: isMobileScreen ? Animations[variant].enter.keyframes : Animations.nonMobile.enter.keyframes,
|
||||
options: isMobileScreen ? MobileOptions : NonMobileOptions,
|
||||
options: isMobileScreen ? MobileModalAnimationOptions : NonMobileOptions,
|
||||
initialStyle: {
|
||||
transformOrigin: isMobileScreen
|
||||
? Animations[variant].enter.transformOrigin
|
||||
@@ -117,7 +114,7 @@ export const useModalAnimation = (
|
||||
},
|
||||
exit: {
|
||||
keyframes: isMobileScreen ? Animations[variant].exit.keyframes : Animations.nonMobile.exit.keyframes,
|
||||
options: isMobileScreen ? MobileOptions : NonMobileOptions,
|
||||
options: isMobileScreen ? MobileModalAnimationOptions : NonMobileOptions,
|
||||
initialStyle: {
|
||||
transformOrigin: isMobileScreen
|
||||
? Animations[variant].exit.transformOrigin
|
||||
|
||||
Reference in New Issue
Block a user