2019-06-23 01:45:32 +01:00
|
|
|
import React from 'react';
|
2019-06-29 06:49:08 +01:00
|
|
|
import { Route } from 'react-router';
|
2019-06-23 01:45:32 +01:00
|
|
|
import { CSSTransition, TransitionGroup } from 'react-transition-group';
|
|
|
|
|
2020-07-03 22:19:05 +01:00
|
|
|
const TransitionRouter: React.FC = ({ children }) => (
|
2019-06-29 06:17:29 +01:00
|
|
|
<Route
|
|
|
|
render={({ location }) => (
|
|
|
|
<TransitionGroup className={'route-transition-group'}>
|
2020-07-03 22:19:05 +01:00
|
|
|
<CSSTransition key={location.key} timeout={250} in appear classNames={'fade'}>
|
2019-06-29 06:17:29 +01:00
|
|
|
<section>
|
2020-04-17 19:17:01 +01:00
|
|
|
{children}
|
2019-06-29 06:17:29 +01:00
|
|
|
</section>
|
|
|
|
</CSSTransition>
|
|
|
|
</TransitionGroup>
|
|
|
|
)}
|
|
|
|
/>
|
2019-06-23 01:45:32 +01:00
|
|
|
);
|
2020-07-03 22:19:05 +01:00
|
|
|
|
|
|
|
export default TransitionRouter;
|