Skip to content

Commit

Permalink
[@mantine/core] Fix pop-top-* transitions
Browse files Browse the repository at this point in the history
Fixes #1657
  • Loading branch information
rmburg committed Oct 21, 2023
1 parent 05e26d7 commit 1f633df
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/mantine-core/src/components/Transition/transitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<MantineTransitionName, MantineTransitionStyles> = {
fade: {
Expand Down Expand Up @@ -120,27 +120,27 @@ export const transitions: Record<MantineTransitionName, MantineTransitionStyles>
},

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' },
},
};

0 comments on commit 1f633df

Please sign in to comment.