Added: Sidebar nav rendering
This commit is contained in:
@@ -1,6 +1,53 @@
|
|||||||
|
import { NavLink } from 'react-router-dom';
|
||||||
import XIcon from '../../assets/icons/X-close-icon';
|
import XIcon from '../../assets/icons/X-close-icon';
|
||||||
import styles from './sidebar.module.css';
|
import styles from './sidebar.module.css';
|
||||||
|
|
||||||
|
const items = {
|
||||||
|
title: {
|
||||||
|
icon: '',
|
||||||
|
text: 'Main link',
|
||||||
|
link: '/',
|
||||||
|
},
|
||||||
|
subs: [
|
||||||
|
{
|
||||||
|
text: 'Sub links',
|
||||||
|
link: '/',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: 'Sub links',
|
||||||
|
link: '/',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: 'Sub links',
|
||||||
|
link: '/',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: 'Sub links',
|
||||||
|
link: '/',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: 'Sub links',
|
||||||
|
link: '/',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
const NavGroupItems = ({ list }) => (
|
||||||
|
<div className={styles.sidebarGroup}>
|
||||||
|
<NavLink to={list.title.link}>
|
||||||
|
<div className={styles.sidebarMainItem}>
|
||||||
|
<XIcon />
|
||||||
|
{list.title.text}
|
||||||
|
</div>
|
||||||
|
</NavLink>
|
||||||
|
{list.subs.map((subLink) => (
|
||||||
|
<NavLink to={subLink.link}>
|
||||||
|
<div className={styles.sidebarSubItem}>{subLink.text}</div>
|
||||||
|
</NavLink>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
|
||||||
export default function Sidebar({ isMobileScreen, isOpen, setOpen }) {
|
export default function Sidebar({ isMobileScreen, isOpen, setOpen }) {
|
||||||
if (!isMobileScreen && isOpen) {
|
if (!isMobileScreen && isOpen) {
|
||||||
return (
|
return (
|
||||||
@@ -15,7 +62,10 @@ export default function Sidebar({ isMobileScreen, isOpen, setOpen }) {
|
|||||||
<XIcon />
|
<XIcon />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.sidebarNav}></div>
|
<div className={styles.sidebarList}>
|
||||||
|
<NavGroupItems list={items} />
|
||||||
|
<NavGroupItems list={items} />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
background: #2d373c;
|
background: #2d373c;
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
min-width: 350px;
|
min-width: 350px;
|
||||||
padding: 40px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* @media only screen and (max-width: 800px) {
|
/* @media only screen and (max-width: 800px) {
|
||||||
@@ -14,6 +13,7 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: baseline;
|
align-items: baseline;
|
||||||
|
padding: 40px 40px 30px 40px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.closeIcon {
|
.closeIcon {
|
||||||
@@ -28,3 +28,12 @@
|
|||||||
|
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.sidebarList {
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebarMainItem {
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebarSubItem {
|
||||||
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ export default function TopBar({ isMobileScreen, isSidebarOpen, setSidebarOpen }
|
|||||||
>
|
>
|
||||||
{isSidebarOpen ? null : <HamburgerIcon color="#000" />}
|
{isSidebarOpen ? null : <HamburgerIcon color="#000" />}
|
||||||
</div>
|
</div>
|
||||||
<div>Other icons here</div>
|
<div>Right side icons here</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user