1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-25 12:56:41 +07:00

added fading animations

This commit is contained in:
Fedor Katurov 2020-09-11 13:27:04 +07:00
parent d935e9de42
commit 0f09078bbf
3 changed files with 78 additions and 16 deletions

View file

@ -0,0 +1,33 @@
import React, { FC } from 'react';
import { URLS } from '~/constants/urls';
import { FlowLayout } from '~/containers/flow/FlowLayout';
import { NodeLayout } from '~/containers/node/NodeLayout';
import { BorisLayout } from '~/containers/node/BorisLayout';
import { ErrorNotFound } from '~/containers/pages/ErrorNotFound';
import { ProfilePage } from '~/containers/profile/ProfilePage';
import { CSSTransition, TransitionGroup } from 'react-transition-group';
import { Redirect, Route, Switch, useLocation } from 'react-router';
interface IProps {}
const MainRouter: FC<IProps> = () => {
const location = useLocation();
return (
<TransitionGroup>
<CSSTransition key={location.key} classNames="fade" timeout={500}>
<Switch location={location}>
<Route exact path={URLS.BASE} component={FlowLayout} />
<Route path={URLS.NODE_URL(':id')} component={NodeLayout} />
<Route path={URLS.BORIS} component={BorisLayout} />
<Route path={URLS.ERRORS.NOT_FOUND} component={ErrorNotFound} />
<Route path={URLS.PROFILE_PAGE(':username')} component={ProfilePage} />
<Redirect to="/" />
</Switch>
</CSSTransition>
</TransitionGroup>
);
};
export { MainRouter };