mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 21:06:42 +07:00
added fading animations
This commit is contained in:
parent
d935e9de42
commit
0f09078bbf
3 changed files with 78 additions and 16 deletions
33
src/containers/main/MainRouter/index.tsx
Normal file
33
src/containers/main/MainRouter/index.tsx
Normal 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 };
|
Loading…
Add table
Add a link
Reference in a new issue