2019-01-12 03:33:27 +00:00
|
|
|
import animate from './css-animation';
|
2018-02-05 11:12:41 +00:00
|
|
|
const getTransitionProps = (transitionName, opt = {}) => {
|
2020-09-23 09:32:53 +00:00
|
|
|
if (process.env.NODE_ENV === 'test') {
|
|
|
|
return { css: false, ...opt };
|
|
|
|
}
|
2018-02-05 11:12:41 +00:00
|
|
|
const transitionProps = {
|
2020-06-11 10:27:27 +00:00
|
|
|
appear: true,
|
|
|
|
css: false,
|
|
|
|
onEnter: (el, done) => {
|
2020-07-26 08:30:14 +00:00
|
|
|
transitionName ? animate(el, `${transitionName}-enter`, done) : done();
|
2018-02-05 11:12:41 +00:00
|
|
|
},
|
2020-06-11 10:27:27 +00:00
|
|
|
onLeave: (el, done) => {
|
2020-07-26 08:30:14 +00:00
|
|
|
transitionName ? animate(el, `${transitionName}-leave`, done) : done();
|
2018-02-05 11:12:41 +00:00
|
|
|
},
|
2020-06-11 10:27:27 +00:00
|
|
|
...opt,
|
2019-01-12 03:33:27 +00:00
|
|
|
};
|
|
|
|
return transitionProps;
|
|
|
|
};
|
2018-02-05 11:12:41 +00:00
|
|
|
|
2019-01-12 03:33:27 +00:00
|
|
|
export default getTransitionProps;
|