Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs] Migrate List demos to emotion #25266

Merged
22 changes: 4 additions & 18 deletions docs/src/pages/components/lists/AlignItemsList.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as React from 'react';
import { makeStyles } from '@material-ui/core/styles';
import List from '@material-ui/core/List';
import ListItem from '@material-ui/core/ListItem';
import Divider from '@material-ui/core/Divider';
Expand All @@ -8,22 +7,9 @@ import ListItemAvatar from '@material-ui/core/ListItemAvatar';
import Avatar from '@material-ui/core/Avatar';
import Typography from '@material-ui/core/Typography';

const useStyles = makeStyles((theme) => ({
root: {
width: '100%',
maxWidth: 360,
backgroundColor: theme.palette.background.paper,
},
inline: {
display: 'inline',
},
}));

export default function AlignItemsList() {
const classes = useStyles();

return (
<List className={classes.root}>
<List sx={{ width: '100%', maxWidth: 360, bgcolor: 'background.paper' }}>
<ListItem alignItems="flex-start">
<ListItemAvatar>
<Avatar alt="Remy Sharp" src="/static/images/avatar/1.jpg" />
Expand All @@ -33,9 +19,9 @@ export default function AlignItemsList() {
secondary={
<React.Fragment>
<Typography
sx={{ display: 'inline' }}
component="span"
variant="body2"
className={classes.inline}
color="textPrimary"
>
Ali Connors
Expand All @@ -55,9 +41,9 @@ export default function AlignItemsList() {
secondary={
<React.Fragment>
<Typography
sx={{ display: 'inline' }}
component="span"
variant="body2"
className={classes.inline}
color="textPrimary"
>
to Scott, Alex, Jennifer
Expand All @@ -77,9 +63,9 @@ export default function AlignItemsList() {
secondary={
<React.Fragment>
<Typography
sx={{ display: 'inline' }}
component="span"
variant="body2"
className={classes.inline}
color="textPrimary"
>
Sandra Adams
Expand Down
24 changes: 4 additions & 20 deletions docs/src/pages/components/lists/AlignItemsList.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as React from 'react';
import { createStyles, Theme, makeStyles } from '@material-ui/core/styles';
import List from '@material-ui/core/List';
import ListItem from '@material-ui/core/ListItem';
import Divider from '@material-ui/core/Divider';
Expand All @@ -8,24 +7,9 @@ import ListItemAvatar from '@material-ui/core/ListItemAvatar';
import Avatar from '@material-ui/core/Avatar';
import Typography from '@material-ui/core/Typography';

const useStyles = makeStyles((theme: Theme) =>
createStyles({
root: {
width: '100%',
maxWidth: 360,
backgroundColor: theme.palette.background.paper,
},
inline: {
display: 'inline',
},
}),
);

export default function AlignItemsList() {
const classes = useStyles();

return (
<List className={classes.root}>
<List sx={{ width: '100%', maxWidth: 360, bgcolor: 'background.paper' }}>
<ListItem alignItems="flex-start">
<ListItemAvatar>
<Avatar alt="Remy Sharp" src="/static/images/avatar/1.jpg" />
Expand All @@ -35,9 +19,9 @@ export default function AlignItemsList() {
secondary={
<React.Fragment>
<Typography
sx={{ display: 'inline' }}
component="span"
variant="body2"
className={classes.inline}
color="textPrimary"
>
Ali Connors
Expand All @@ -57,9 +41,9 @@ export default function AlignItemsList() {
secondary={
<React.Fragment>
<Typography
sx={{ display: 'inline' }}
component="span"
variant="body2"
className={classes.inline}
color="textPrimary"
>
to Scott, Alex, Jennifer
Expand All @@ -79,9 +63,9 @@ export default function AlignItemsList() {
secondary={
<React.Fragment>
<Typography
sx={{ display: 'inline' }}
component="span"
variant="body2"
className={classes.inline}
color="textPrimary"
>
Sandra Adams
Expand Down
12 changes: 1 addition & 11 deletions docs/src/pages/components/lists/CheckboxList.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as React from 'react';
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';
Expand All @@ -9,16 +8,7 @@ import Checkbox from '@material-ui/core/Checkbox';
import IconButton from '@material-ui/core/IconButton';
import CommentIcon from '@material-ui/icons/Comment';

const useStyles = makeStyles((theme) => ({
root: {
width: '100%',
maxWidth: 360,
backgroundColor: theme.palette.background.paper,
},
}));

export default function CheckboxList() {
const classes = useStyles();
const [checked, setChecked] = React.useState([0]);

const handleToggle = (value) => () => {
Expand All @@ -35,7 +25,7 @@ export default function CheckboxList() {
};

return (
<List className={classes.root}>
<List sx={{ width: '100%', maxWidth: 360, bgcolor: 'background.paper' }}>
{[0, 1, 2, 3].map((value) => {
const labelId = `checkbox-list-label-${value}`;

Expand Down
14 changes: 1 addition & 13 deletions docs/src/pages/components/lists/CheckboxList.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as React from 'react';
import { createStyles, makeStyles, Theme } 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';
Expand All @@ -9,18 +8,7 @@ import Checkbox from '@material-ui/core/Checkbox';
import IconButton from '@material-ui/core/IconButton';
import CommentIcon from '@material-ui/icons/Comment';

const useStyles = makeStyles((theme: Theme) =>
createStyles({
root: {
width: '100%',
maxWidth: 360,
backgroundColor: theme.palette.background.paper,
},
}),
);

export default function CheckboxList() {
const classes = useStyles();
const [checked, setChecked] = React.useState([0]);

const handleToggle = (value: number) => () => {
Expand All @@ -37,7 +25,7 @@ export default function CheckboxList() {
};

return (
<List className={classes.root}>
<List sx={{ width: '100%', maxWidth: 360, bgcolor: 'background.paper' }}>
{[0, 1, 2, 3].map((value) => {
const labelId = `checkbox-list-label-${value}`;

Expand Down
12 changes: 1 addition & 11 deletions docs/src/pages/components/lists/CheckboxListSecondary.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as React from 'react';
import { makeStyles } from '@material-ui/core/styles';
import List from '@material-ui/core/List';
import ListItem from '@material-ui/core/ListItem';
import ListItemSecondaryAction from '@material-ui/core/ListItemSecondaryAction';
Expand All @@ -8,16 +7,7 @@ import ListItemAvatar from '@material-ui/core/ListItemAvatar';
import Checkbox from '@material-ui/core/Checkbox';
import Avatar from '@material-ui/core/Avatar';

const useStyles = makeStyles((theme) => ({
root: {
width: '100%',
maxWidth: 360,
backgroundColor: theme.palette.background.paper,
},
}));

export default function CheckboxListSecondary() {
const classes = useStyles();
const [checked, setChecked] = React.useState([1]);

const handleToggle = (value) => () => {
Expand All @@ -34,7 +24,7 @@ export default function CheckboxListSecondary() {
};

return (
<List dense className={classes.root}>
<List dense sx={{ width: '100%', maxWidth: 360, bgcolor: 'background.paper' }}>
{[0, 1, 2, 3].map((value) => {
const labelId = `checkbox-list-secondary-label-${value}`;
return (
Expand Down
14 changes: 1 addition & 13 deletions docs/src/pages/components/lists/CheckboxListSecondary.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as React from 'react';
import { createStyles, makeStyles, Theme } from '@material-ui/core/styles';
import List from '@material-ui/core/List';
import ListItem from '@material-ui/core/ListItem';
import ListItemSecondaryAction from '@material-ui/core/ListItemSecondaryAction';
Expand All @@ -8,18 +7,7 @@ import ListItemAvatar from '@material-ui/core/ListItemAvatar';
import Checkbox from '@material-ui/core/Checkbox';
import Avatar from '@material-ui/core/Avatar';

const useStyles = makeStyles((theme: Theme) =>
createStyles({
root: {
width: '100%',
maxWidth: 360,
backgroundColor: theme.palette.background.paper,
},
}),
);

export default function CheckboxListSecondary() {
const classes = useStyles();
const [checked, setChecked] = React.useState([1]);

const handleToggle = (value: number) => () => {
Expand All @@ -36,7 +24,7 @@ export default function CheckboxListSecondary() {
};

return (
<List dense className={classes.root}>
<List dense sx={{ width: '100%', maxWidth: 360, bgcolor: 'background.paper' }}>
{[0, 1, 2, 3].map((value) => {
const labelId = `checkbox-list-secondary-label-${value}`;
return (
Expand Down
13 changes: 1 addition & 12 deletions docs/src/pages/components/lists/FolderList.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as React from 'react';
import { makeStyles } from '@material-ui/core/styles';
import List from '@material-ui/core/List';
import ListItem from '@material-ui/core/ListItem';
import ListItemText from '@material-ui/core/ListItemText';
Expand All @@ -9,19 +8,9 @@ import ImageIcon from '@material-ui/icons/Image';
import WorkIcon from '@material-ui/icons/Work';
import BeachAccessIcon from '@material-ui/icons/BeachAccess';

const useStyles = makeStyles((theme) => ({
root: {
width: '100%',
maxWidth: 360,
backgroundColor: theme.palette.background.paper,
},
}));

export default function FolderList() {
const classes = useStyles();

return (
<List className={classes.root}>
<List sx={{ width: '100%', maxWidth: 360, bgcolor: 'background.paper' }}>
<ListItem>
<ListItemAvatar>
<Avatar>
Expand Down
15 changes: 1 addition & 14 deletions docs/src/pages/components/lists/FolderList.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as React from 'react';
import { createStyles, Theme, makeStyles } from '@material-ui/core/styles';
import List from '@material-ui/core/List';
import ListItem from '@material-ui/core/ListItem';
import ListItemText from '@material-ui/core/ListItemText';
Expand All @@ -9,21 +8,9 @@ import ImageIcon from '@material-ui/icons/Image';
import WorkIcon from '@material-ui/icons/Work';
import BeachAccessIcon from '@material-ui/icons/BeachAccess';

const useStyles = makeStyles((theme: Theme) =>
createStyles({
root: {
width: '100%',
maxWidth: 360,
backgroundColor: theme.palette.background.paper,
},
}),
);

export default function FolderList() {
const classes = useStyles();

return (
<List className={classes.root}>
<List sx={{ width: '100%', maxWidth: 360, bgcolor: 'background.paper' }}>
<ListItem>
<ListItemAvatar>
<Avatar>
Expand Down
13 changes: 1 addition & 12 deletions docs/src/pages/components/lists/GutterlessList.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,14 @@
import * as React from 'react';
import { makeStyles } from '@material-ui/core/styles';
import List from '@material-ui/core/List';
import ListItem from '@material-ui/core/ListItem';
import ListItemSecondaryAction from '@material-ui/core/ListItemSecondaryAction';
import ListItemText from '@material-ui/core/ListItemText';
import CommentIcon from '@material-ui/icons/Comment';
import IconButton from '@material-ui/core/IconButton';

const useStyles = makeStyles((theme) => ({
root: {
width: '100%',
maxWidth: 360,
backgroundColor: theme.palette.background.paper,
},
}));

export default function GutterlessList() {
const classes = useStyles();

return (
<List className={classes.root}>
<List sx={{ width: '100%', maxWidth: 360, bgcolor: 'background.paper' }}>
{[1, 2, 3].map((value) => (
<ListItem key={value} disableGutters>
<ListItemText primary={`Line item ${value}`} />
Expand Down
15 changes: 1 addition & 14 deletions docs/src/pages/components/lists/GutterlessList.tsx
Original file line number Diff line number Diff line change
@@ -1,27 +1,14 @@
import * as React from 'react';
import { createStyles, makeStyles, Theme } from '@material-ui/core/styles';
import List from '@material-ui/core/List';
import ListItem from '@material-ui/core/ListItem';
import ListItemSecondaryAction from '@material-ui/core/ListItemSecondaryAction';
import ListItemText from '@material-ui/core/ListItemText';
import CommentIcon from '@material-ui/icons/Comment';
import IconButton from '@material-ui/core/IconButton';

const useStyles = makeStyles((theme: Theme) =>
createStyles({
root: {
width: '100%',
maxWidth: 360,
backgroundColor: theme.palette.background.paper,
},
}),
);

export default function GutterlessList() {
const classes = useStyles();

return (
<List className={classes.root}>
<List sx={{ width: '100%', maxWidth: 360, bgcolor: 'background.paper' }}>
{[1, 2, 3].map((value) => (
<ListItem key={value} disableGutters>
<ListItemText primary={`Line item ${value}`} />
Expand Down
Loading