@@ -2,7 +2,7 @@ import React, {Fragment, useState} from 'react'
2
2
import PropTypes from 'prop-types'
3
3
import List from '@material-ui/core/List'
4
4
import { ListItem , ListItemText , Collapse , ListItemIcon , makeStyles } from '@material-ui/core'
5
- import { ExpandLess , ExpandMore } from '@material-ui/icons'
5
+ import { ArrowRight , ArrowDropDown } from '@material-ui/icons'
6
6
import './sidebar.css'
7
7
8
8
const darkTheme = {
@@ -20,7 +20,7 @@ function SidebarItem ({label, name, items, depthStep = 10, depth = 0, Icon}) {
20
20
[ name ] : ! currentState [ name ]
21
21
} ) )
22
22
}
23
- const expandBtn = open => open ? < ExpandLess /> : < ExpandMore />
23
+ const expandBtn = open => ! open ? < ArrowDropDown /> : < ArrowRight />
24
24
return (
25
25
< Fragment >
26
26
< ListItem onClick = { handleClick } button dense >
@@ -54,16 +54,17 @@ function SidebarItem ({label, name, items, depthStep = 10, depth = 0, Icon}) {
54
54
SidebarItem . propTypes = {
55
55
label : PropTypes . string ,
56
56
name : PropTypes . string ,
57
+ Icon : PropTypes . node ,
57
58
items : PropTypes . array ,
58
59
depth : PropTypes . number ,
59
60
theme : PropTypes . object ,
60
61
depthStep : PropTypes . number
61
62
}
62
63
63
- function Sidebar ( { items, theme, icon, width} ) {
64
+ function Sidebar ( { items, theme, backgroundColor , style , icon, width} ) {
64
65
const useStyles = makeStyles ( material => {
65
66
let themeColor = {
66
- backgroundColor : material . palette . background . paper ,
67
+ backgroundColor : backgroundColor || material . palette . background . paper ,
67
68
color : '#000'
68
69
}
69
70
if ( theme === 'dark' ) {
@@ -73,6 +74,7 @@ function Sidebar ({items, theme, icon, width}) {
73
74
root : {
74
75
width : width ,
75
76
maxWidth : width ,
77
+ ...style ,
76
78
...themeColor
77
79
} ,
78
80
nested : {
@@ -110,6 +112,7 @@ Sidebar.propTypes = {
110
112
height : PropTypes . string ,
111
113
items : PropTypes . array ,
112
114
onClick : PropTypes . func ,
115
+ style : PropTypes . object ,
113
116
theme : PropTypes . string ,
114
117
width : PropTypes . string
115
118
}
0 commit comments