-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSidebar.js
90 lines (74 loc) · 3.22 KB
/
Sidebar.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
import './Sidebar.css';
import { useState } from 'react'
import logo from '../images/logo.svg';
import GridViewIcon from '@mui/icons-material/GridView';
import SettingsIcon from '@mui/icons-material/Settings';
import PersonOutlineIcon from '@mui/icons-material/PersonOutline';
import SearchIcon from '@mui/icons-material/Search';
import LogoutIcon from '@mui/icons-material/Logout';
import {Link} from 'react-router-dom'
// components for showing the sidebar
//takes in props which it uses to differentiate from other sidebars components
const Sidebar = (props) => {
// useState gives a local state in a function component
// the first paramter is the value and the second is the setter
const [isShown, setIsShown] = useState(false);
function changeBody(value){
// console.log(value);
// setBody(value)
props.handleSetBody(value)
}
// onMouseOver={setIsShown(true)}
return(
<div className='sidebar'>
<div className='top'>
<span className='logo'> <img src={logo} className="App-logo-small" alt="logo" /> </span>
</div>
<div className='middle'>
<ul>
{/* if props.page == dashboard show with style changes or else dont */}
{ props.page == 'dashboard'?
<li className='hovered'>
<GridViewIcon className='icon'/>
<span>Dashboard</span>
</li>
:
<li onClick={(e) => {props.handleSetBody('dashboard')}} >
<GridViewIcon className='icon' />
{/* <span>Dashboard</span> */}
</li>
}
{/* if props.page == search show with style changes or else dont */}
{ props.page == 'search'?
<li className='hovered'>
<SearchIcon className='icon'/>
<span>Search</span>
</li>
:
<li onClick={(e) => {props.handleSetBody('search')}} >
<SearchIcon className='icon' />
{isShown && <span>Search3</span> }
</li>
}
{/* if props.page == setting show with style changes or else dont */}
{ props.page == 'setting'?
<li className='hovered'>
<PersonOutlineIcon className='icon'/>
<span>Setting</span>
</li>
:
<li onClick={(e) => {props.handleSetBody('setting')}} >
<PersonOutlineIcon className='icon' />
{/* <span>Setting</span> */}
</li>
}
<li className='bottom-icon ' onClick={(e) => {console.log("logout")}} >
<Link to= '/'> <LogoutIcon className='icon' /> </Link>
{/* <span>Logout</span> */}
</li>
</ul>
</div>
</div>
)
}
export default Sidebar