Change account router
This commit is contained in:
parent
6c04718c35
commit
d777b3b55e
|
@ -4,10 +4,12 @@ import NavigationBar from '@/components/NavigationBar';
|
||||||
import DashboardContainer from '@/components/dashboard/DashboardContainer';
|
import DashboardContainer from '@/components/dashboard/DashboardContainer';
|
||||||
import { NotFound } from '@/components/elements/ScreenBlock';
|
import { NotFound } from '@/components/elements/ScreenBlock';
|
||||||
import TransitionRouter from '@/TransitionRouter';
|
import TransitionRouter from '@/TransitionRouter';
|
||||||
import SubNavigation from '@/components/elements/SubNavigation';
|
|
||||||
import { useLocation } from 'react-router';
|
import { useLocation } from 'react-router';
|
||||||
import Spinner from '@/components/elements/Spinner';
|
import Spinner from '@/components/elements/Spinner';
|
||||||
import routes from '@/routers/routes';
|
import routes from '@/routers/routes';
|
||||||
|
import Sidebar from '@/components/Sidebar';
|
||||||
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||||
|
import { IconProp } from '@fortawesome/fontawesome-svg-core';
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
|
@ -16,17 +18,18 @@ export default () => {
|
||||||
<>
|
<>
|
||||||
<NavigationBar />
|
<NavigationBar />
|
||||||
{location.pathname.startsWith('/account') && (
|
{location.pathname.startsWith('/account') && (
|
||||||
<SubNavigation>
|
<Sidebar>
|
||||||
<div>
|
{routes.account
|
||||||
{routes.account
|
.filter((route) => !!route.name)
|
||||||
.filter((route) => !!route.name)
|
.map(({ path, name, exact = false, iconProp }) => (
|
||||||
.map(({ path, name, exact = false }) => (
|
<NavLink key={path} to={`/account/${path}`.replace('//', '/')} exact={exact}>
|
||||||
<NavLink key={path} to={`/account/${path}`.replace('//', '/')} exact={exact}>
|
<div className='icon'>
|
||||||
{name}
|
<FontAwesomeIcon icon={iconProp as IconProp} />
|
||||||
</NavLink>
|
</div>
|
||||||
))}
|
{name}
|
||||||
</div>
|
</NavLink>
|
||||||
</SubNavigation>
|
))}
|
||||||
|
</Sidebar>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<TransitionRouter>
|
<TransitionRouter>
|
||||||
|
|
Loading…
Reference in New Issue