11import React , { useEffect } from "react"
2- import { styled } from "@material-ui/core/styles"
3- import Box from "@material-ui/core/Box"
4- import * as muiColors from "@material-ui/core/colors"
2+ import { styled } from "@mui/material/styles"
3+ import { createTheme , ThemeProvider } from "@mui/material/styles"
4+ import Box from "@mui/material/Box"
5+ import * as muiColors from "@mui/material/colors"
56import SidebarBoxContainer from "../SidebarBoxContainer"
67import colors from "../colors"
7- import BallotIcon from "@material-ui /icons/Ballot"
8+ import BallotIcon from "@mui /icons-material /Ballot"
89import capitalize from "lodash/capitalize"
910import classnames from "classnames"
1011
11- const LabelContainer = styled ( "div" ) ( {
12+ const theme = createTheme ( )
13+ const LabelContainer = styled ( "div" ) ( ( { theme } ) => ( {
1214 display : "flex" ,
1315 paddingTop : 4 ,
1416 paddingBottom : 4 ,
@@ -25,31 +27,31 @@ const LabelContainer = styled("div")({
2527 opacity : 1 ,
2628 fontWeight : "bold" ,
2729 } ,
28- } )
29- const Circle = styled ( "div" ) ( {
30+ } ) )
31+ const Circle = styled ( "div" ) ( ( { theme } ) => ( {
3032 width : 12 ,
3133 height : 12 ,
3234 borderRadius : 12 ,
3335 marginRight : 8 ,
34- } )
35- const Label = styled ( "div" ) ( {
36+ } ) )
37+ const Label = styled ( "div" ) ( ( { theme } ) => ( {
3638 fontSize : 11 ,
37- } )
38- const DashSep = styled ( "div" ) ( {
39+ } ) )
40+ const DashSep = styled ( "div" ) ( ( { theme } ) => ( {
3941 flexGrow : 1 ,
4042 borderBottom : `2px dotted ${ muiColors . grey [ 300 ] } ` ,
4143 marginLeft : 8 ,
4244 marginRight : 8 ,
43- } )
44- const Number = styled ( "div" ) ( {
45+ } ) )
46+ const Number = styled ( "div" ) ( ( { theme } ) => ( {
4547 fontSize : 11 ,
4648 textAlign : "center" ,
4749 minWidth : 14 ,
4850 paddingTop : 2 ,
4951 paddingBottom : 2 ,
5052 fontWeight : "bold" ,
5153 color : muiColors . grey [ 700 ] ,
52- } )
54+ } ) )
5355
5456export const ClassSelectionMenu = ( {
5557 selectedCls,
@@ -73,29 +75,33 @@ export const ClassSelectionMenu = ({
7375 } , [ regionClsList , selectedCls ] )
7476
7577 return (
76- < SidebarBoxContainer
77- title = "Classifications"
78- subTitle = ""
79- icon = { < BallotIcon style = { { color : muiColors . grey [ 700 ] } } /> }
80- expandedByDefault
81- >
82- { regionClsList . map ( ( label , index ) => (
83- < LabelContainer
84- className = { classnames ( { selected : label === selectedCls } ) }
85- onClick = { ( ) => onSelectCls ( label ) }
86- >
87- < Circle style = { { backgroundColor : colors [ index % colors . length ] } } />
88- < Label className = { classnames ( { selected : label === selectedCls } ) } >
89- { capitalize ( label ) }
90- </ Label >
91- < DashSep />
92- < Number className = { classnames ( { selected : label === selectedCls } ) } >
93- { index < 9 ? `Key [${ index + 1 } ]` : "" }
94- </ Number >
95- </ LabelContainer >
96- ) ) }
97- < Box pb = { 2 } />
98- </ SidebarBoxContainer >
78+ < ThemeProvider theme = { theme } >
79+ < SidebarBoxContainer
80+ title = "Classifications"
81+ subTitle = ""
82+ icon = { < BallotIcon style = { { color : muiColors . grey [ 700 ] } } /> }
83+ expandedByDefault
84+ >
85+ { regionClsList . map ( ( label , index ) => (
86+ < LabelContainer
87+ className = { classnames ( { selected : label === selectedCls } ) }
88+ onClick = { ( ) => onSelectCls ( label ) }
89+ >
90+ < Circle
91+ style = { { backgroundColor : colors [ index % colors . length ] } }
92+ />
93+ < Label className = { classnames ( { selected : label === selectedCls } ) } >
94+ { capitalize ( label ) }
95+ </ Label >
96+ < DashSep />
97+ < Number className = { classnames ( { selected : label === selectedCls } ) } >
98+ { index < 9 ? `Key [${ index + 1 } ]` : "" }
99+ </ Number >
100+ </ LabelContainer >
101+ ) ) }
102+ < Box pb = { 2 } />
103+ </ SidebarBoxContainer >
104+ </ ThemeProvider >
99105 )
100106}
101107
0 commit comments