Skip to content

Commit

Permalink
Use class instead of sx
Browse files Browse the repository at this point in the history
  • Loading branch information
jcardus committed Nov 14, 2024
1 parent 547dafb commit f4cef90
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 12 deletions.
22 changes: 16 additions & 6 deletions src/reports/components/ReportsMenu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,27 @@ import RouteIcon from '@mui/icons-material/Route';
import EventRepeatIcon from '@mui/icons-material/EventRepeat';
import NotesIcon from '@mui/icons-material/Notes';
import { Link, useLocation } from 'react-router-dom';
import makeStyles from '@mui/styles/makeStyles';
import { useTranslation } from '../../common/components/LocalizationProvider';
import { useAdministrator, useRestriction } from '../../common/util/permissions';

const useStyles = makeStyles({
menuItemText: {
whiteSpace: 'nowrap',
},
});

const MenuItem = ({
title, link, icon, selected,
}) => (
<ListItemButton key={link} component={Link} to={link} selected={selected}>
<ListItemIcon>{icon}</ListItemIcon>
<ListItemText primary={title} sx={{ whiteSpace: 'nowrap' }} />
</ListItemButton>
);
}) => {
const classes = useStyles();
return (
<ListItemButton key={link} component={Link} to={link} selected={selected}>
<ListItemIcon>{icon}</ListItemIcon>
<ListItemText primary={title} className={classes.menuItemText} />
</ListItemButton>
);
};

const ReportsMenu = () => {
const t = useTranslation();
Expand Down
22 changes: 16 additions & 6 deletions src/settings/components/SettingsMenu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,30 @@ import HelpIcon from '@mui/icons-material/Help';
import CampaignIcon from '@mui/icons-material/Campaign';
import { Link, useLocation } from 'react-router-dom';
import { useSelector } from 'react-redux';
import makeStyles from '@mui/styles/makeStyles';
import { useTranslation } from '../../common/components/LocalizationProvider';
import {
useAdministrator, useManager, useRestriction,
} from '../../common/util/permissions';
import useFeatures from '../../common/util/useFeatures';

const useStyles = makeStyles({
menuItemText: {
whiteSpace: 'nowrap',
},
});

const MenuItem = ({
title, link, icon, selected,
}) => (
<ListItemButton key={link} component={Link} to={link} selected={selected}>
<ListItemIcon>{icon}</ListItemIcon>
<ListItemText primary={title} sx={{ whiteSpace: 'nowrap' }} />
</ListItemButton>
);
}) => {
const classes = useStyles();
return (
<ListItemButton key={link} component={Link} to={link} selected={selected}>
<ListItemIcon>{icon}</ListItemIcon>
<ListItemText primary={title} className={classes.menuItemText} />
</ListItemButton>
);
};

const SettingsMenu = () => {
const t = useTranslation();
Expand Down

0 comments on commit f4cef90

Please sign in to comment.