clean up nav item
This commit is contained in:
1 parent
035edd92f4
commit
7900e1104f
1 file changed
+15
-11
@@ -8,7 +8,15 @@ import PropTypes from "prop-types";
|
||||
|
||||
const NavItem = ({ item, collapsed, selected, onClick }) => {
|
||||
const theme = useTheme();
|
||||
const iconStroke = selected
|
||||
? theme.palette.primary.contrastText
|
||||
: theme.palette.primary.contrastTextTertiary;
|
||||
|
||||
const buttonBgColor = selected ? theme.palette.secondary.main : "transparent";
|
||||
const buttonBgHoverColor = selected
|
||||
? theme.palette.secondary.main
|
||||
: theme.palette.tertiary.main;
|
||||
const fontWeight = selected ? 600 : 400;
|
||||
return (
|
||||
<Tooltip
|
||||
placement="right"
|
||||
@@ -29,13 +37,11 @@ const NavItem = ({ item, collapsed, selected, onClick }) => {
|
||||
>
|
||||
<ListItemButton
|
||||
sx={{
|
||||
backgroundColor: selected ? theme.palette.secondary.main : "transparent",
|
||||
backgroundColor: buttonBgColor,
|
||||
"&:hover": {
|
||||
backgroundColor: selected
|
||||
? theme.palette.secondary.main
|
||||
: theme.palette.tertiary.main,
|
||||
backgroundColor: buttonBgHoverColor,
|
||||
},
|
||||
height: "37px",
|
||||
height: 37,
|
||||
gap: theme.spacing(4),
|
||||
borderRadius: theme.shape.borderRadius,
|
||||
px: theme.spacing(4),
|
||||
@@ -47,14 +53,12 @@ const NavItem = ({ item, collapsed, selected, onClick }) => {
|
||||
sx={{
|
||||
minWidth: 0,
|
||||
"& svg": {
|
||||
height: "20px",
|
||||
width: "20px",
|
||||
height: 20,
|
||||
width: 20,
|
||||
opacity: 0.81,
|
||||
},
|
||||
"& svg path": {
|
||||
stroke: selected
|
||||
? theme.palette.primary.contrastText
|
||||
: theme.palette.primary.contrastTextTertiary,
|
||||
stroke: iconStroke,
|
||||
},
|
||||
}}
|
||||
>
|
||||
@@ -72,7 +76,7 @@ const NavItem = ({ item, collapsed, selected, onClick }) => {
|
||||
variant="body1"
|
||||
color={theme.palette.primary.contrastText}
|
||||
sx={{
|
||||
fontWeight: selected ? 600 : 400,
|
||||
fontWeight: fontWeight,
|
||||
opacity: 0.9,
|
||||
}}
|
||||
>
|
||||
|
||||
Reference in new issue
Block a user