Skip to content

Commit

Permalink
[docs] Don't suggest putting a Switch inside a ListItemSecondaryAction (
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcljx authored Oct 13, 2020
1 parent f4a6c00 commit 6f59621
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 48 deletions.
2 changes: 1 addition & 1 deletion docs/src/pages/components/lists/AlignItemsList.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Typography from '@material-ui/core/Typography';
const useStyles = makeStyles((theme) => ({
root: {
width: '100%',
maxWidth: '36ch',
maxWidth: 360,
backgroundColor: theme.palette.background.paper,
},
inline: {
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/components/lists/AlignItemsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const useStyles = makeStyles((theme: Theme) =>
createStyles({
root: {
width: '100%',
maxWidth: '36ch',
maxWidth: 360,
backgroundColor: theme.palette.background.paper,
},
inline: {
Expand Down
37 changes: 16 additions & 21 deletions docs/src/pages/components/lists/SwitchListSecondary.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { makeStyles } from '@material-ui/core/styles';
import List from '@material-ui/core/List';
import ListItem from '@material-ui/core/ListItem';
import ListItemIcon from '@material-ui/core/ListItemIcon';
import ListItemSecondaryAction from '@material-ui/core/ListItemSecondaryAction';
import ListItemText from '@material-ui/core/ListItemText';
import ListSubheader from '@material-ui/core/ListSubheader';
import Switch from '@material-ui/core/Switch';
Expand Down Expand Up @@ -45,32 +44,28 @@ export default function SwitchListSecondary() {
<WifiIcon />
</ListItemIcon>
<ListItemText id="switch-list-label-wifi" primary="Wi-Fi" />
<ListItemSecondaryAction>
<Switch
edge="end"
onChange={handleToggle('wifi')}
checked={checked.indexOf('wifi') !== -1}
inputProps={{
'aria-labelledby': 'switch-list-label-wifi',
}}
/>
</ListItemSecondaryAction>
<Switch
edge="end"
onChange={handleToggle('wifi')}
checked={checked.indexOf('wifi') !== -1}
inputProps={{
'aria-labelledby': 'switch-list-label-wifi',
}}
/>
</ListItem>
<ListItem>
<ListItemIcon>
<BluetoothIcon />
</ListItemIcon>
<ListItemText id="switch-list-label-bluetooth" primary="Bluetooth" />
<ListItemSecondaryAction>
<Switch
edge="end"
onChange={handleToggle('bluetooth')}
checked={checked.indexOf('bluetooth') !== -1}
inputProps={{
'aria-labelledby': 'switch-list-label-bluetooth',
}}
/>
</ListItemSecondaryAction>
<Switch
edge="end"
onChange={handleToggle('bluetooth')}
checked={checked.indexOf('bluetooth') !== -1}
inputProps={{
'aria-labelledby': 'switch-list-label-bluetooth',
}}
/>
</ListItem>
</List>
);
Expand Down
37 changes: 16 additions & 21 deletions docs/src/pages/components/lists/SwitchListSecondary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { makeStyles, Theme, createStyles } from '@material-ui/core/styles';
import List from '@material-ui/core/List';
import ListItem from '@material-ui/core/ListItem';
import ListItemIcon from '@material-ui/core/ListItemIcon';
import ListItemSecondaryAction from '@material-ui/core/ListItemSecondaryAction';
import ListItemText from '@material-ui/core/ListItemText';
import ListSubheader from '@material-ui/core/ListSubheader';
import Switch from '@material-ui/core/Switch';
Expand Down Expand Up @@ -47,32 +46,28 @@ export default function SwitchListSecondary() {
<WifiIcon />
</ListItemIcon>
<ListItemText id="switch-list-label-wifi" primary="Wi-Fi" />
<ListItemSecondaryAction>
<Switch
edge="end"
onChange={handleToggle('wifi')}
checked={checked.indexOf('wifi') !== -1}
inputProps={{
'aria-labelledby': 'switch-list-label-wifi',
}}
/>
</ListItemSecondaryAction>
<Switch
edge="end"
onChange={handleToggle('wifi')}
checked={checked.indexOf('wifi') !== -1}
inputProps={{
'aria-labelledby': 'switch-list-label-wifi',
}}
/>
</ListItem>
<ListItem>
<ListItemIcon>
<BluetoothIcon />
</ListItemIcon>
<ListItemText id="switch-list-label-bluetooth" primary="Bluetooth" />
<ListItemSecondaryAction>
<Switch
edge="end"
onChange={handleToggle('bluetooth')}
checked={checked.indexOf('bluetooth') !== -1}
inputProps={{
'aria-labelledby': 'switch-list-label-bluetooth',
}}
/>
</ListItemSecondaryAction>
<Switch
edge="end"
onChange={handleToggle('bluetooth')}
checked={checked.indexOf('bluetooth') !== -1}
inputProps={{
'aria-labelledby': 'switch-list-label-bluetooth',
}}
/>
</ListItem>
</List>
);
Expand Down
10 changes: 8 additions & 2 deletions docs/src/pages/components/lists/VirtualizedList.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const useStyles = makeStyles((theme) => ({
root: {
width: '100%',
height: 400,
maxWidth: 300,
maxWidth: 360,
backgroundColor: theme.palette.background.paper,
},
}));
Expand All @@ -28,7 +28,13 @@ export default function VirtualizedList() {

return (
<div className={classes.root}>
<FixedSizeList height={400} width={300} itemSize={46} itemCount={200}>
<FixedSizeList
height={400}
width={360}
itemSize={46}
itemCount={200}
overscanCount={5}
>
{renderRow}
</FixedSizeList>
</div>
Expand Down
10 changes: 8 additions & 2 deletions docs/src/pages/components/lists/VirtualizedList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const useStyles = makeStyles((theme: Theme) =>
root: {
width: '100%',
height: 400,
maxWidth: 300,
maxWidth: 360,
backgroundColor: theme.palette.background.paper,
},
}),
Expand All @@ -30,7 +30,13 @@ export default function VirtualizedList() {

return (
<div className={classes.root}>
<FixedSizeList height={400} width={300} itemSize={46} itemCount={200}>
<FixedSizeList
height={400}
width={360}
itemSize={46}
itemCount={200}
overscanCount={5}
>
{renderRow}
</FixedSizeList>
</div>
Expand Down

0 comments on commit 6f59621

Please sign in to comment.