Skip to content

Commit

Permalink
[@mantine/core] Improve pop-* transitions animations (#5096)
Browse files Browse the repository at this point in the history
Fixes #1657
  • Loading branch information
Narcha committed Oct 22, 2023
1 parent a8e1615 commit 8fe8b0b
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 8fe8b0b

Please sign in to comment.