Skip to content

Commit

Permalink
replace deprecated ListItem with button prop with ListItemButton comp…
Browse files Browse the repository at this point in the history
…onent
  • Loading branch information
ZeeshanTamboli committed Jul 30, 2024
1 parent 9e7c72a commit 208575f
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 20 deletions.
27 changes: 17 additions & 10 deletions docs/data/material/integrations/routing/ListRouter.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as React from 'react';
import PropTypes from 'prop-types';
import List from '@mui/material/List';
import ListItem from '@mui/material/ListItem';
import Box from '@mui/material/Box';
import ListItemButton from '@mui/material/ListItemButton';
import Paper from '@mui/material/Paper';
Expand Down Expand Up @@ -44,12 +45,10 @@ function ListItemLink(props) {
const { icon, primary, to } = props;

return (
<li>
<ListItemButton component={Link} to={to}>
{icon ? <ListItemIcon>{icon}</ListItemIcon> : null}
<ListItemText primary={primary} />
</ListItemButton>
</li>
<ListItemButton component={Link} to={to}>
{icon ? <ListItemIcon>{icon}</ListItemIcon> : null}
<ListItemText primary={primary} />
</ListItemButton>
);
}

Expand Down Expand Up @@ -78,13 +77,21 @@ export default function ListRouter() {

<Paper elevation={0}>
<List aria-label="main mailbox folders">
<ListItemLink to="/inbox" primary="Inbox" icon={<InboxIcon />} />
<ListItemLink to="/drafts" primary="Drafts" icon={<DraftsIcon />} />
<ListItem disablePadding>
<ListItemLink to="/inbox" primary="Inbox" icon={<InboxIcon />} />
</ListItem>
<ListItem disablePadding>
<ListItemLink to="/drafts" primary="Drafts" icon={<DraftsIcon />} />
</ListItem>
</List>
<Divider />
<List aria-label="secondary mailbox folders">
<ListItemLink to="/trash" primary="Trash" />
<ListItemLink to="/spam" primary="Spam" />
<ListItem disablePadding>
<ListItemLink to="/trash" primary="Trash" />
</ListItem>
<ListItem disablePadding>
<ListItemLink to="/spam" primary="Spam" />
</ListItem>
</List>
</Paper>
</Box>
Expand Down
27 changes: 17 additions & 10 deletions docs/data/material/integrations/routing/ListRouter.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as React from 'react';
import List from '@mui/material/List';
import ListItem from '@mui/material/ListItem';
import Box from '@mui/material/Box';
import ListItemButton from '@mui/material/ListItemButton';
import Paper from '@mui/material/Paper';
Expand Down Expand Up @@ -48,12 +49,10 @@ function ListItemLink(props: ListItemLinkProps) {
const { icon, primary, to } = props;

return (
<li>
<ListItemButton component={Link} to={to}>
{icon ? <ListItemIcon>{icon}</ListItemIcon> : null}
<ListItemText primary={primary} />
</ListItemButton>
</li>
<ListItemButton component={Link} to={to}>
{icon ? <ListItemIcon>{icon}</ListItemIcon> : null}
<ListItemText primary={primary} />
</ListItemButton>
);
}

Expand All @@ -76,13 +75,21 @@ export default function ListRouter() {

<Paper elevation={0}>
<List aria-label="main mailbox folders">
<ListItemLink to="/inbox" primary="Inbox" icon={<InboxIcon />} />
<ListItemLink to="/drafts" primary="Drafts" icon={<DraftsIcon />} />
<ListItem disablePadding>
<ListItemLink to="/inbox" primary="Inbox" icon={<InboxIcon />} />
</ListItem>
<ListItem disablePadding>
<ListItemLink to="/drafts" primary="Drafts" icon={<DraftsIcon />} />
</ListItem>
</List>
<Divider />
<List aria-label="secondary mailbox folders">
<ListItemLink to="/trash" primary="Trash" />
<ListItemLink to="/spam" primary="Spam" />
<ListItem disablePadding>
<ListItemLink to="/trash" primary="Trash" />
</ListItem>
<ListItem disablePadding>
<ListItemLink to="/spam" primary="Spam" />
</ListItem>
</List>
</Paper>
</Box>
Expand Down

0 comments on commit 208575f

Please sign in to comment.