Skip to content

Commit

Permalink
fix: sidebar text color
Browse files Browse the repository at this point in the history
  • Loading branch information
pranavkparti committed Aug 26, 2024
1 parent 03be1e3 commit eaf1b53
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 23 deletions.
49 changes: 30 additions & 19 deletions src/components/layout/Menu/MenuItem/LinkItem.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { ItemButtonStyled, ItemIconStyled, LinkItemStyled } from './MenuItemStyled';
import {
ItemButtonStyled,
ItemIconStyled,
LinkItemStyled,
} from './MenuItemStyled';
import ListItemText from '@mui/material/ListItemText';
import * as React from 'react';
import Badge from '@mui/material/Badge';
Expand All @@ -7,34 +11,41 @@ const StyledBadge = styled(Badge)(({ theme }) => ({
marginLeft: theme.spacing(1),
}));


const LinkItem = ({ itemPath, itemName, itemIcon, isActive, open, pendingCount }) => {
const LinkItem = ({
itemPath,
itemName,
itemIcon,
isActive,
open,
pendingCount,
}) => {
return (

<LinkItemStyled to={itemPath} isActive={isActive}>
<ItemButtonStyled open={open}>
<ItemIconStyled open={open}>
<ItemIconStyled open={open} isActive={isActive}>
{itemIcon}
</ItemIconStyled>
<ListItemText
primary={itemName}
sx={{ opacity: open ? 1 : 0, marginLeft: open ? '1rem' : 0, fontWeight: 'bold' }}
sx={{
opacity: open ? 1 : 0,
marginLeft: open ? '1rem' : 0,
fontWeight: 'bold',
}}
/>
{ pendingCount &&
<StyledBadge
badgeContent={pendingCount}
color="error"
anchorOrigin={{
vertical: 'top',
horizontal: 'right',
}}
>
</StyledBadge>
}
{pendingCount && (
<StyledBadge
badgeContent={pendingCount}
color="error"
anchorOrigin={{
vertical: 'top',
horizontal: 'right',
}}
></StyledBadge>
)}
</ItemButtonStyled>
</LinkItemStyled>

);
};

export default LinkItem;
export default LinkItem;
7 changes: 3 additions & 4 deletions src/components/layout/Menu/MenuItem/MenuItemStyled.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ import { NavLink } from 'react-router-dom';

const LinkItemStyled = styled(NavLink)(({ theme, isActive }) => ({
textDecoration: 'none',
color: isActive
? theme.palette.primary.main
: theme.palette.primary.lightMain,
color: isActive ? theme.palette.stats.white : theme.palette.primary.lightMain,
backgroundColor: isActive ? theme.palette.action.active : null,
width: '14.5rem',
}));
Expand All @@ -17,10 +15,11 @@ const ItemButtonStyled = styled(ListItemButton)(({ open }) => ({
px: 2.5,
}));

const ItemIconStyled = styled(ListItemIcon)(({ open }) => ({
const ItemIconStyled = styled(ListItemIcon)(({ open, theme, isActive }) => ({
minWidth: 0,
mr: open ? 3 : 'auto',
justifyContent: 'center',
color: isActive ? theme.palette.stats.white : theme.palette.primary.lightMain,
}));

export { ItemButtonStyled, ItemIconStyled, LinkItemStyled };

0 comments on commit eaf1b53

Please sign in to comment.