clean up nav item

This commit is contained in:
Alex Holliday committed 2025-08-01 15:52:55 -07:00
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 NavItem = ({ item, collapsed, selected, onClick }) => {
const theme = useTheme(); 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 ( return (
<Tooltip <Tooltip
placement="right" placement="right"
@@ -29,13 +37,11 @@ const NavItem = ({ item, collapsed, selected, onClick }) => {
> >
<ListItemButton <ListItemButton
sx={{ sx={{
backgroundColor: selected ? theme.palette.secondary.main : "transparent", backgroundColor: buttonBgColor,
"&:hover": { "&:hover": {
backgroundColor: selected backgroundColor: buttonBgHoverColor,
? theme.palette.secondary.main
: theme.palette.tertiary.main,
}, },
height: "37px", height: 37,
gap: theme.spacing(4), gap: theme.spacing(4),
borderRadius: theme.shape.borderRadius, borderRadius: theme.shape.borderRadius,
px: theme.spacing(4), px: theme.spacing(4),
@@ -47,14 +53,12 @@ const NavItem = ({ item, collapsed, selected, onClick }) => {
sx={{ sx={{
minWidth: 0, minWidth: 0,
"& svg": { "& svg": {
height: "20px", height: 20,
width: "20px", width: 20,
opacity: 0.81, opacity: 0.81,
}, },
"& svg path": { "& svg path": {
stroke: selected stroke: iconStroke,
? theme.palette.primary.contrastText
: theme.palette.primary.contrastTextTertiary,
}, },
}} }}
> >
@@ -72,7 +76,7 @@ const NavItem = ({ item, collapsed, selected, onClick }) => {
variant="body1" variant="body1"
color={theme.palette.primary.contrastText} color={theme.palette.primary.contrastText}
sx={{ sx={{
fontWeight: selected ? 600 : 400, fontWeight: fontWeight,
opacity: 0.9, opacity: 0.9,
}} }}
> >