Skip to content

Commit

Permalink
refactor: change Header element to Sidebar
Browse files Browse the repository at this point in the history
  • Loading branch information
shootermv committed Oct 17, 2023
1 parent df33ddd commit ac00614
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion src/App.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
flex-direction: row;
font-family: Heebo;

> .header {
> .sidebar {
height: 100vh;
background-color: white;
padding: 30px;
Expand Down
4 changes: 2 additions & 2 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { PageSearchState, SearchContext } from './model/pageState'
import moment from 'moment'
import DashboardPage from './pages/dashboard/DashboardPage'
import { useSessionStorage } from 'usehooks-ts'
import Header from './pages/components/header/Header'
import SideBar from './pages/components/header/SideBar'
import RealtimeMapPage from './pages/RealtimeMapPage'
import SingleLineMapPage from './pages/SingleLineMapPage'
import { useLocation } from 'react-router-dom'
Expand Down Expand Up @@ -158,7 +158,7 @@ const App = () => {
<LocalizationProvider dateAdapter={AdapterMoment} adapterLocale="he">
<ConfigProvider direction="rtl" locale={heIL}>
<StyledLayout className="main">
<Header pages={PAGES} />
<SideBar pages={PAGES} />
<Layout>
<StyledContent>
<StyledBody>
Expand Down
19 changes: 0 additions & 19 deletions src/pages/components/header/Header.tsx

This file was deleted.

19 changes: 19 additions & 0 deletions src/pages/components/header/SideBar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React, { useState } from 'react'
import Menu, { MenuPage } from './menu/Menu'
import cn from 'classnames'

export default function SideBar({ pages }: { pages: MenuPage[] }) {
const [open, setOpen] = useState(false)

return (
<aside className={cn('sidebar', { open })}>
<div className="sideber-menu" onClick={() => setOpen(!open)}>
<div className="sideber-menu-line" />
<div className="sideber-menu-line" />
<div className="sideber-menu-line" />
</div>
<h1>דאטאבוס</h1>
<Menu pages={pages} />
</aside>
)
}
8 changes: 4 additions & 4 deletions src/pages/components/header/menu/menu.scss
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,18 @@
}
}

.header-menu {
.sideber-menu {
display: none;
}

@media screen and (max-width: $mobile-max-width) {

.main > .header {
.main > .sidebar {
max-width: 0;
padding: 0;
transition: all 0.2s ease-in-out;

.header-menu {
.sideber-menu {
display: block;
position: absolute;
top: 0;
Expand All @@ -56,7 +56,7 @@
}
}

.main > .header.open{
.main > .sidebar.open{
display: block;
position: absolute;
z-index: 500;
Expand Down

0 comments on commit ac00614

Please sign in to comment.