From 1f633dfedb26927a4ef1d7f4d82c5b0dd9c8c1d8 Mon Sep 17 00:00:00 2001 From: Narcha <42248344+Narcha@users.noreply.github.com> Date: Sat, 21 Oct 2023 21:54:23 +0200 Subject: [PATCH] [@mantine/core] Fix `pop-top-*` transitions Fixes #1657 --- .../src/components/Transition/transitions.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/mantine-core/src/components/Transition/transitions.ts b/src/mantine-core/src/components/Transition/transitions.ts index a8a6cdc645a..dd8237d3667 100644 --- a/src/mantine-core/src/components/Transition/transitions.ts +++ b/src/mantine-core/src/components/Transition/transitions.ts @@ -29,11 +29,11 @@ export type MantineTransitionName = export type MantineTransition = MantineTransitionName | MantineTransitionStyles; -const popIn = { +const popIn = (from: 'top' | 'bottom') => ({ in: { opacity: 1, transform: 'scale(1)' }, - out: { opacity: 0, transform: `scale(.9) translateY(${rem(10)})` }, + out: { opacity: 0, transform: `scale(.9) translateY(${rem(from === 'bottom' ? 10 : -10)})` }, transitionProperty: 'transform, opacity', -}; +}); export const transitions: Record = { fade: { @@ -120,27 +120,27 @@ export const transitions: Record }, pop: { - ...popIn, + ...popIn('bottom'), common: { transformOrigin: 'center center' }, }, 'pop-bottom-left': { - ...popIn, + ...popIn('bottom'), common: { transformOrigin: 'bottom left' }, }, 'pop-bottom-right': { - ...popIn, + ...popIn('bottom'), common: { transformOrigin: 'bottom right' }, }, 'pop-top-left': { - ...popIn, + ...popIn('top'), common: { transformOrigin: 'top left' }, }, 'pop-top-right': { - ...popIn, + ...popIn('top'), common: { transformOrigin: 'top right' }, }, };