Added: sidebar open-close
This commit is contained in:
@@ -1,9 +1,23 @@
|
|||||||
|
import XIcon from '../../assets/icons/X-close-icon';
|
||||||
import styles from './sidebar.module.css';
|
import styles from './sidebar.module.css';
|
||||||
|
|
||||||
export default function Sidebar() {
|
export default function Sidebar({ isMobileScreen, isOpen, setOpen }) {
|
||||||
return (
|
if (!isMobileScreen && isOpen) {
|
||||||
<div className={styles.navSidebar}>
|
return (
|
||||||
<div className={styles.sidebarBranding}>Plaidware</div>
|
<div className={styles.navSidebar}>
|
||||||
</div>
|
<div className={styles.sidebarBrandingHeader}>
|
||||||
);
|
<div className={styles.sidebarBranding}>Plaidware</div>
|
||||||
|
<div
|
||||||
|
onClick={() => {
|
||||||
|
setOpen(false);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<XIcon />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className={styles.sidebarNav}></div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,9 +2,24 @@
|
|||||||
grid-column: 1;
|
grid-column: 1;
|
||||||
background: #2d373c;
|
background: #2d373c;
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
|
min-width: 350px;
|
||||||
padding: 40px;
|
padding: 40px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* @media only screen and (max-width: 800px) {
|
||||||
|
|
||||||
|
} */
|
||||||
|
|
||||||
|
.sidebarBrandingHeader {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: baseline;
|
||||||
|
}
|
||||||
|
|
||||||
|
.closeIcon {
|
||||||
|
font-size: larger;
|
||||||
|
}
|
||||||
|
|
||||||
.sidebarBranding {
|
.sidebarBranding {
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
|||||||
@@ -1,8 +1,18 @@
|
|||||||
import React from 'react'
|
import React from 'react';
|
||||||
import styles from './topbar.module.css'
|
import HamburgerIcon from '../../assets/icons/Hamburger-icon';
|
||||||
|
import styles from './topbar.module.css';
|
||||||
|
|
||||||
export default function TopBar() {
|
export default function TopBar({ isMobileScreen, isSidebarOpen, setSidebarOpen }) {
|
||||||
return (
|
return (
|
||||||
<div className={styles.topBar}>search comes here</div>
|
<div className={styles.topBar}>
|
||||||
)
|
<div
|
||||||
|
onClick={() => {
|
||||||
|
setSidebarOpen(true);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{isSidebarOpen ? null : <HamburgerIcon color="#000" />}
|
||||||
|
</div>
|
||||||
|
<div>Other icons here</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
.topBar {
|
.topBar {
|
||||||
grid-row: 1;
|
grid-row: 1;
|
||||||
|
|
||||||
padding: 24px 48px;
|
padding: 24px 48px;
|
||||||
box-shadow: 0px 1px 4px rgba(0, 0, 0, 0.08);
|
box-shadow: 0px 1px 4px rgba(0, 0, 0, 0.08);
|
||||||
|
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
.dashboardGrid {
|
.dashboardGrid {
|
||||||
width: 100vw;
|
width: 100vw;
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 300px auto;
|
grid-template-columns: max-content auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mainContent {
|
.mainContent {
|
||||||
@@ -10,7 +10,19 @@
|
|||||||
grid-template-rows: 108px 72px auto;
|
grid-template-rows: 108px 72px auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media only screen and (max-width: 800px) {
|
||||||
|
.dashboardGrid {
|
||||||
|
grid-template-columns: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mainContent {
|
||||||
|
grid-column: 1;
|
||||||
|
grid-template-rows: 50px 50px auto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.content {
|
.content {
|
||||||
grid-row: 3;
|
grid-row: 3;
|
||||||
padding: 24px 48px;
|
padding: 24px 48px;
|
||||||
|
min-height: 100%;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,21 @@
|
|||||||
|
import { useState } from 'react';
|
||||||
import { Outlet } from 'react-router-dom';
|
import { Outlet } from 'react-router-dom';
|
||||||
|
|
||||||
import Breadcrumbs from '../../components/breadcrumbs';
|
import Breadcrumbs from '../../components/breadcrumbs';
|
||||||
import Sidebar from '../../components/Sidebar';
|
import Sidebar from '../../components/Sidebar';
|
||||||
import TopBar from '../../components/topbar';
|
import TopBar from '../../components/topbar';
|
||||||
|
import useWindowDimensions from '../../hooks/useWindowDimensions';
|
||||||
import styles from './dashboard.module.css';
|
import styles from './dashboard.module.css';
|
||||||
|
|
||||||
export default function Dashboard() {
|
export default function Dashboard() {
|
||||||
|
const [sidebarOpen, setSidebarOpen] = useState(true);
|
||||||
|
const { isMobileScreen } = useWindowDimensions();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.dashboardGrid}>
|
<div className={styles.dashboardGrid}>
|
||||||
<Sidebar />
|
<Sidebar isMobileScreen={isMobileScreen} isOpen={sidebarOpen} setOpen={setSidebarOpen} />
|
||||||
<div className={styles.mainContent}>
|
<div className={styles.mainContent}>
|
||||||
<TopBar />
|
<TopBar isMobileScreen={isMobileScreen} isSidebarOpen={sidebarOpen} setSidebarOpen={setSidebarOpen} />
|
||||||
<Breadcrumbs />
|
<Breadcrumbs />
|
||||||
<div className={styles.content}>
|
<div className={styles.content}>
|
||||||
<Outlet />
|
<Outlet />
|
||||||
|
|||||||
Reference in New Issue
Block a user