Skip to content

[docs] Migrate Card demos to emotion #25557

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

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 3 additions & 15 deletions docs/src/pages/components/cards/ActionAreaCard.js
Original file line number Diff line number Diff line change
@@ -1,36 +1,24 @@
import * as React from 'react';
import { makeStyles } from '@material-ui/core/styles';
import Card from '@material-ui/core/Card';
import CardContent from '@material-ui/core/CardContent';
import CardMedia from '@material-ui/core/CardMedia';
import Typography from '@material-ui/core/Typography';
import { CardActionArea } from '@material-ui/core';

const useStyles = makeStyles({
root: {
maxWidth: 345,
},
media: {
height: 140,
},
});

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

return (
<Card className={classes.root}>
<Card sx={{ maxWidth: 345 }}>
<CardActionArea>
<CardMedia
className={classes.media}
sx={{ height: 140 }}
image="/static/images/cards/contemplative-reptile.jpg"
title="Contemplative Reptile"
/>
<CardContent>
<Typography gutterBottom variant="h5" component="div">
Lizard
</Typography>
<Typography variant="body2" color="textSecondary" component="p">
<Typography variant="body2" color="text.secondary">
Lizards are a widespread group of squamate reptiles, with over 6,000
species, ranging across all continents except Antarctica
</Typography>
18 changes: 3 additions & 15 deletions docs/src/pages/components/cards/ActionAreaCard.tsx
Original file line number Diff line number Diff line change
@@ -1,36 +1,24 @@
import * as React from 'react';
import { makeStyles } from '@material-ui/core/styles';
import Card from '@material-ui/core/Card';
import CardContent from '@material-ui/core/CardContent';
import CardMedia from '@material-ui/core/CardMedia';
import Typography from '@material-ui/core/Typography';
import { CardActionArea } from '@material-ui/core';

const useStyles = makeStyles({
root: {
maxWidth: 345,
},
media: {
height: 140,
},
});

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

return (
<Card className={classes.root}>
<Card sx={{ maxWidth: 345 }}>
<CardActionArea>
<CardMedia
className={classes.media}
sx={{ height: 140 }}
image="/static/images/cards/contemplative-reptile.jpg"
title="Contemplative Reptile"
/>
<CardContent>
<Typography gutterBottom variant="h5" component="div">
Lizard
</Typography>
<Typography variant="body2" color="textSecondary" component="p">
<Typography variant="body2" color="text.secondary">
Lizards are a widespread group of squamate reptiles, with over 6,000
species, ranging across all continents except Antarctica
</Typography>
Original file line number Diff line number Diff line change
@@ -1,45 +1,34 @@
import * as React from 'react';
import { makeStyles } from '@material-ui/core/styles';
import Box from '@material-ui/core/Box';
import Card from '@material-ui/core/Card';
import CardActions from '@material-ui/core/CardActions';
import CardContent from '@material-ui/core/CardContent';
import Button from '@material-ui/core/Button';
import Typography from '@material-ui/core/Typography';

const useStyles = makeStyles({
root: {
minWidth: 275,
},
bullet: {
display: 'inline-block',
margin: '0 2px',
transform: 'scale(0.8)',
},
title: {
fontSize: 14,
},
pos: {
marginBottom: 12,
},
});

export default function SimpleCard() {
const classes = useStyles();
const bull = <span className={classes.bullet}></span>;
const bull = (
<Box
component="span"
sx={{ display: 'inline-block', mx: '2px', transform: 'scale(0.8)' }}
>
</Box>
);

export default function BasicCard() {
return (
<Card className={classes.root}>
<Card sx={{ minWidth: 275 }}>
<CardContent>
<Typography className={classes.title} color="textSecondary" gutterBottom>
<Typography sx={{ fontSize: 14 }} color="text.secondary" gutterBottom>
Word of the Day
</Typography>
<Typography variant="h5" component="div">
be{bull}nev{bull}o{bull}lent
</Typography>
<Typography className={classes.pos} color="textSecondary">
<Typography sx={{ mb: 1.5 }} color="text.secondary">
adjective
</Typography>
<Typography variant="body2" component="p">
<Typography variant="body2">
well meaning and kindly.
<br />
{'"a benevolent smile"'}
Original file line number Diff line number Diff line change
@@ -1,45 +1,34 @@
import * as React from 'react';
import { makeStyles } from '@material-ui/core/styles';
import Box from '@material-ui/core/Box';
import Card from '@material-ui/core/Card';
import CardActions from '@material-ui/core/CardActions';
import CardContent from '@material-ui/core/CardContent';
import Button from '@material-ui/core/Button';
import Typography from '@material-ui/core/Typography';

const useStyles = makeStyles({
root: {
minWidth: 275,
},
bullet: {
display: 'inline-block',
margin: '0 2px',
transform: 'scale(0.8)',
},
title: {
fontSize: 14,
},
pos: {
marginBottom: 12,
},
});

export default function SimpleCard() {
const classes = useStyles();
const bull = <span className={classes.bullet}></span>;
const bull = (
<Box
component="span"
sx={{ display: 'inline-block', mx: '2px', transform: 'scale(0.8)' }}
>
</Box>
);

export default function BasicCard() {
return (
<Card className={classes.root}>
<Card sx={{ minWidth: 275 }}>
<CardContent>
<Typography className={classes.title} color="textSecondary" gutterBottom>
<Typography sx={{ fontSize: 14 }} color="text.secondary" gutterBottom>
Word of the Day
</Typography>
<Typography variant="h5" component="div">
be{bull}nev{bull}o{bull}lent
</Typography>
<Typography className={classes.pos} color="textSecondary">
<Typography sx={{ mb: 1.5 }} color="text.secondary">
adjective
</Typography>
<Typography variant="body2" component="p">
<Typography variant="body2">
well meaning and kindly.
<br />
{'"a benevolent smile"'}
13 changes: 2 additions & 11 deletions docs/src/pages/components/cards/ImgMediaCard.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,14 @@
import * as React from 'react';
import { makeStyles } from '@material-ui/core/styles';
import Card from '@material-ui/core/Card';
import CardActions from '@material-ui/core/CardActions';
import CardContent from '@material-ui/core/CardContent';
import CardMedia from '@material-ui/core/CardMedia';
import Button from '@material-ui/core/Button';
import Typography from '@material-ui/core/Typography';

const useStyles = makeStyles({
root: {
maxWidth: 345,
},
});

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

return (
<Card className={classes.root}>
<Card sx={{ maxWidth: 345 }}>
<CardMedia
component="img"
alt="Contemplative Reptile"
@@ -29,7 +20,7 @@ export default function ImgMediaCard() {
<Typography gutterBottom variant="h5" component="div">
Lizard
</Typography>
<Typography variant="body2" color="textSecondary" component="p">
<Typography variant="body2" color="text.secondary">
Lizards are a widespread group of squamate reptiles, with over 6,000
species, ranging across all continents except Antarctica
</Typography>
13 changes: 2 additions & 11 deletions docs/src/pages/components/cards/ImgMediaCard.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,14 @@
import * as React from 'react';
import { makeStyles } from '@material-ui/core/styles';
import Card from '@material-ui/core/Card';
import CardActions from '@material-ui/core/CardActions';
import CardContent from '@material-ui/core/CardContent';
import CardMedia from '@material-ui/core/CardMedia';
import Button from '@material-ui/core/Button';
import Typography from '@material-ui/core/Typography';

const useStyles = makeStyles({
root: {
maxWidth: 345,
},
});

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

return (
<Card className={classes.root}>
<Card sx={{ maxWidth: 345 }}>
<CardMedia
component="img"
alt="Contemplative Reptile"
@@ -29,7 +20,7 @@ export default function ImgMediaCard() {
<Typography gutterBottom variant="h5" component="div">
Lizard
</Typography>
<Typography variant="body2" color="textSecondary" component="p">
<Typography variant="body2" color="text.secondary">
Lizards are a widespread group of squamate reptiles, with over 6,000
species, ranging across all continents except Antarctica
</Typography>
18 changes: 3 additions & 15 deletions docs/src/pages/components/cards/MediaCard.js
Original file line number Diff line number Diff line change
@@ -1,36 +1,24 @@
import * as React from 'react';
import { makeStyles } from '@material-ui/core/styles';
import Card from '@material-ui/core/Card';
import CardActions from '@material-ui/core/CardActions';
import CardContent from '@material-ui/core/CardContent';
import CardMedia from '@material-ui/core/CardMedia';
import Button from '@material-ui/core/Button';
import Typography from '@material-ui/core/Typography';

const useStyles = makeStyles({
root: {
maxWidth: 345,
},
media: {
height: 140,
},
});

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

return (
<Card className={classes.root}>
<Card sx={{ maxWidth: 345 }}>
<CardMedia
className={classes.media}
sx={{ height: 140 }}
image="/static/images/cards/contemplative-reptile.jpg"
title="Contemplative Reptile"
/>
<CardContent>
<Typography gutterBottom variant="h5" component="div">
Lizard
</Typography>
<Typography variant="body2" color="textSecondary" component="p">
<Typography variant="body2" color="text.secondary">
Lizards are a widespread group of squamate reptiles, with over 6,000
species, ranging across all continents except Antarctica
</Typography>
18 changes: 3 additions & 15 deletions docs/src/pages/components/cards/MediaCard.tsx
Original file line number Diff line number Diff line change
@@ -1,36 +1,24 @@
import * as React from 'react';
import { makeStyles } from '@material-ui/core/styles';
import Card from '@material-ui/core/Card';
import CardActions from '@material-ui/core/CardActions';
import CardContent from '@material-ui/core/CardContent';
import CardMedia from '@material-ui/core/CardMedia';
import Button from '@material-ui/core/Button';
import Typography from '@material-ui/core/Typography';

const useStyles = makeStyles({
root: {
maxWidth: 345,
},
media: {
height: 140,
},
});

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

return (
<Card className={classes.root}>
<Card sx={{ maxWidth: 345 }}>
<CardMedia
className={classes.media}
sx={{ height: 140 }}
image="/static/images/cards/contemplative-reptile.jpg"
title="Contemplative Reptile"
/>
<CardContent>
<Typography gutterBottom variant="h5" component="div">
Lizard
</Typography>
<Typography variant="body2" color="textSecondary" component="p">
<Typography variant="body2" color="text.secondary">
Lizards are a widespread group of squamate reptiles, with over 6,000
species, ranging across all continents except Antarctica
</Typography>
48 changes: 11 additions & 37 deletions docs/src/pages/components/cards/MediaControlCard.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as React from 'react';
import { makeStyles, useTheme } from '@material-ui/core/styles';
import { useTheme } from '@material-ui/core/styles';
import Box from '@material-ui/core/Box';
import Card from '@material-ui/core/Card';
import CardContent from '@material-ui/core/CardContent';
import CardMedia from '@material-ui/core/CardMedia';
@@ -9,61 +10,34 @@ import SkipPreviousIcon from '@material-ui/icons/SkipPrevious';
import PlayArrowIcon from '@material-ui/icons/PlayArrow';
import SkipNextIcon from '@material-ui/icons/SkipNext';

const useStyles = makeStyles((theme) => ({
root: {
display: 'flex',
},
details: {
display: 'flex',
flexDirection: 'column',
},
content: {
flex: '1 0 auto',
},
cover: {
width: 151,
},
controls: {
display: 'flex',
alignItems: 'center',
paddingLeft: theme.spacing(1),
paddingBottom: theme.spacing(1),
},
playIcon: {
height: 38,
width: 38,
},
}));

export default function MediaControlCard() {
const classes = useStyles();
const theme = useTheme();

return (
<Card className={classes.root}>
<div className={classes.details}>
<CardContent className={classes.content}>
<Card sx={{ display: 'flex' }}>
<Box sx={{ display: 'flex', flexDirection: 'column' }}>
<CardContent sx={{ flex: '1 0 auto' }}>
<Typography component="div" variant="h5">
Live From Space
</Typography>
<Typography variant="subtitle1" color="textSecondary" component="div">
<Typography variant="subtitle1" color="text.secondary" component="div">
Mac Miller
</Typography>
</CardContent>
<div className={classes.controls}>
<Box sx={{ display: 'flex', alignItems: 'center', pl: 1, pb: 1 }}>
<IconButton aria-label="previous">
{theme.direction === 'rtl' ? <SkipNextIcon /> : <SkipPreviousIcon />}
</IconButton>
<IconButton aria-label="play/pause">
<PlayArrowIcon className={classes.playIcon} />
<PlayArrowIcon sx={{ height: 38, width: 38 }} />
</IconButton>
<IconButton aria-label="next">
{theme.direction === 'rtl' ? <SkipPreviousIcon /> : <SkipNextIcon />}
</IconButton>
</div>
</div>
</Box>
</Box>
<CardMedia
className={classes.cover}
sx={{ width: 151 }}
image="/static/images/cards/live-from-space.jpg"
title="Live from space album cover"
/>
50 changes: 11 additions & 39 deletions docs/src/pages/components/cards/MediaControlCard.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as React from 'react';
import { Theme, createStyles, makeStyles, useTheme } from '@material-ui/core/styles';
import { useTheme } from '@material-ui/core/styles';
import Box from '@material-ui/core/Box';
import Card from '@material-ui/core/Card';
import CardContent from '@material-ui/core/CardContent';
import CardMedia from '@material-ui/core/CardMedia';
@@ -9,63 +10,34 @@ import SkipPreviousIcon from '@material-ui/icons/SkipPrevious';
import PlayArrowIcon from '@material-ui/icons/PlayArrow';
import SkipNextIcon from '@material-ui/icons/SkipNext';

const useStyles = makeStyles((theme: Theme) =>
createStyles({
root: {
display: 'flex',
},
details: {
display: 'flex',
flexDirection: 'column',
},
content: {
flex: '1 0 auto',
},
cover: {
width: 151,
},
controls: {
display: 'flex',
alignItems: 'center',
paddingLeft: theme.spacing(1),
paddingBottom: theme.spacing(1),
},
playIcon: {
height: 38,
width: 38,
},
}),
);

export default function MediaControlCard() {
const classes = useStyles();
const theme = useTheme();

return (
<Card className={classes.root}>
<div className={classes.details}>
<CardContent className={classes.content}>
<Card sx={{ display: 'flex' }}>
<Box sx={{ display: 'flex', flexDirection: 'column' }}>
<CardContent sx={{ flex: '1 0 auto' }}>
<Typography component="div" variant="h5">
Live From Space
</Typography>
<Typography variant="subtitle1" color="textSecondary" component="div">
<Typography variant="subtitle1" color="text.secondary" component="div">
Mac Miller
</Typography>
</CardContent>
<div className={classes.controls}>
<Box sx={{ display: 'flex', alignItems: 'center', pl: 1, pb: 1 }}>
<IconButton aria-label="previous">
{theme.direction === 'rtl' ? <SkipNextIcon /> : <SkipPreviousIcon />}
</IconButton>
<IconButton aria-label="play/pause">
<PlayArrowIcon className={classes.playIcon} />
<PlayArrowIcon sx={{ height: 38, width: 38 }} />
</IconButton>
<IconButton aria-label="next">
{theme.direction === 'rtl' ? <SkipPreviousIcon /> : <SkipNextIcon />}
</IconButton>
</div>
</div>
</Box>
</Box>
<CardMedia
className={classes.cover}
sx={{ width: 151 }}
image="/static/images/cards/live-from-space.jpg"
title="Live from space album cover"
/>
18 changes: 3 additions & 15 deletions docs/src/pages/components/cards/MultiActionAreaCard.js
Original file line number Diff line number Diff line change
@@ -1,36 +1,24 @@
import * as React from 'react';
import { makeStyles } from '@material-ui/core/styles';
import Card from '@material-ui/core/Card';
import CardContent from '@material-ui/core/CardContent';
import CardMedia from '@material-ui/core/CardMedia';
import Typography from '@material-ui/core/Typography';
import { Button, CardActionArea, CardActions } from '@material-ui/core';

const useStyles = makeStyles({
root: {
maxWidth: 345,
},
media: {
height: 140,
},
});

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

return (
<Card className={classes.root}>
<Card sx={{ maxWidth: 345 }}>
<CardActionArea>
<CardMedia
className={classes.media}
sx={{ height: 140 }}
image="/static/images/cards/contemplative-reptile.jpg"
title="Contemplative Reptile"
/>
<CardContent>
<Typography gutterBottom variant="h5" component="div">
Lizard
</Typography>
<Typography variant="body2" color="textSecondary" component="p">
<Typography variant="body2" color="text.secondary">
Lizards are a widespread group of squamate reptiles, with over 6,000
species, ranging across all continents except Antarctica
</Typography>
18 changes: 3 additions & 15 deletions docs/src/pages/components/cards/MultiActionAreaCard.tsx
Original file line number Diff line number Diff line change
@@ -1,36 +1,24 @@
import * as React from 'react';
import { makeStyles } from '@material-ui/core/styles';
import Card from '@material-ui/core/Card';
import CardContent from '@material-ui/core/CardContent';
import CardMedia from '@material-ui/core/CardMedia';
import Typography from '@material-ui/core/Typography';
import { Button, CardActionArea, CardActions } from '@material-ui/core';

const useStyles = makeStyles({
root: {
maxWidth: 345,
},
media: {
height: 140,
},
});

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

return (
<Card className={classes.root}>
<Card sx={{ maxWidth: 345 }}>
<CardActionArea>
<CardMedia
className={classes.media}
sx={{ height: 140 }}
image="/static/images/cards/contemplative-reptile.jpg"
title="Contemplative Reptile"
/>
<CardContent>
<Typography gutterBottom variant="h5" component="div">
Lizard
</Typography>
<Typography variant="body2" color="textSecondary" component="p">
<Typography variant="body2" color="text.secondary">
Lizards are a widespread group of squamate reptiles, with over 6,000
species, ranging across all continents except Antarctica
</Typography>
77 changes: 36 additions & 41 deletions docs/src/pages/components/cards/OutlinedCard.js
Original file line number Diff line number Diff line change
@@ -1,53 +1,48 @@
import * as React from 'react';
import { makeStyles } from '@material-ui/core/styles';
import Box from '@material-ui/core/Box';
import Card from '@material-ui/core/Card';
import CardActions from '@material-ui/core/CardActions';
import CardContent from '@material-ui/core/CardContent';
import Button from '@material-ui/core/Button';
import Typography from '@material-ui/core/Typography';

const useStyles = makeStyles({
root: {
minWidth: 275,
},
bullet: {
display: 'inline-block',
margin: '0 2px',
transform: 'scale(0.8)',
},
title: {
fontSize: 14,
},
pos: {
marginBottom: 12,
},
});
const bull = (
<Box
component="span"
sx={{ display: 'inline-block', mx: '2px', transform: 'scale(0.8)' }}
>
</Box>
);

export default function OutlinedCard() {
const classes = useStyles();
const bull = <span className={classes.bullet}></span>;
const card = (
<React.Fragment>
<CardContent>
<Typography sx={{ fontSize: 14 }} color="text.secondary" gutterBottom>
Word of the Day
</Typography>
<Typography variant="h5" component="div">
be{bull}nev{bull}o{bull}lent
</Typography>
<Typography sx={{ mb: 1.5 }} color="text.secondary">
adjective
</Typography>
<Typography variant="body2">
well meaning and kindly.
<br />
{'"a benevolent smile"'}
</Typography>
</CardContent>
<CardActions>
<Button size="small">Learn More</Button>
</CardActions>
</React.Fragment>
);

export default function OutlinedCard() {
return (
<Card className={classes.root} variant="outlined">
<CardContent>
<Typography className={classes.title} color="textSecondary" gutterBottom>
Word of the Day
</Typography>
<Typography variant="h5" component="div">
be{bull}nev{bull}o{bull}lent
</Typography>
<Typography className={classes.pos} color="textSecondary">
adjective
</Typography>
<Typography variant="body2" component="p">
well meaning and kindly.
<br />
{'"a benevolent smile"'}
</Typography>
</CardContent>
<CardActions>
<Button size="small">Learn More</Button>
</CardActions>
</Card>
<Box sx={{ minWidth: 275 }}>
<Card variant="outlined">{card}</Card>
</Box>
);
}
77 changes: 36 additions & 41 deletions docs/src/pages/components/cards/OutlinedCard.tsx
Original file line number Diff line number Diff line change
@@ -1,53 +1,48 @@
import * as React from 'react';
import { makeStyles } from '@material-ui/core/styles';
import Box from '@material-ui/core/Box';
import Card from '@material-ui/core/Card';
import CardActions from '@material-ui/core/CardActions';
import CardContent from '@material-ui/core/CardContent';
import Button from '@material-ui/core/Button';
import Typography from '@material-ui/core/Typography';

const useStyles = makeStyles({
root: {
minWidth: 275,
},
bullet: {
display: 'inline-block',
margin: '0 2px',
transform: 'scale(0.8)',
},
title: {
fontSize: 14,
},
pos: {
marginBottom: 12,
},
});
const bull = (
<Box
component="span"
sx={{ display: 'inline-block', mx: '2px', transform: 'scale(0.8)' }}
>
</Box>
);

export default function OutlinedCard() {
const classes = useStyles();
const bull = <span className={classes.bullet}></span>;
const card = (
<React.Fragment>
<CardContent>
<Typography sx={{ fontSize: 14 }} color="text.secondary" gutterBottom>
Word of the Day
</Typography>
<Typography variant="h5" component="div">
be{bull}nev{bull}o{bull}lent
</Typography>
<Typography sx={{ mb: 1.5 }} color="text.secondary">
adjective
</Typography>
<Typography variant="body2">
well meaning and kindly.
<br />
{'"a benevolent smile"'}
</Typography>
</CardContent>
<CardActions>
<Button size="small">Learn More</Button>
</CardActions>
</React.Fragment>
);

export default function OutlinedCard() {
return (
<Card className={classes.root} variant="outlined">
<CardContent>
<Typography className={classes.title} color="textSecondary" gutterBottom>
Word of the Day
</Typography>
<Typography variant="h5" component="div">
be{bull}nev{bull}o{bull}lent
</Typography>
<Typography className={classes.pos} color="textSecondary">
adjective
</Typography>
<Typography variant="body2" component="p">
well meaning and kindly.
<br />
{'"a benevolent smile"'}
</Typography>
</CardContent>
<CardActions>
<Button size="small">Learn More</Button>
</CardActions>
</Card>
<Box sx={{ minWidth: 275 }}>
<Card variant="outlined">{card}</Card>
</Box>
);
}
53 changes: 20 additions & 33 deletions docs/src/pages/components/cards/RecipeReviewCard.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as React from 'react';
import { makeStyles } from '@material-ui/core/styles';
import clsx from 'clsx';
import { experimentalStyled as styled } from '@material-ui/core/styles';
import Card from '@material-ui/core/Card';
import CardHeader from '@material-ui/core/CardHeader';
import CardMedia from '@material-ui/core/CardMedia';
@@ -16,42 +15,29 @@ import ShareIcon from '@material-ui/icons/Share';
import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
import MoreVertIcon from '@material-ui/icons/MoreVert';

const useStyles = makeStyles((theme) => ({
root: {
maxWidth: 345,
},
media: {
height: 0,
paddingTop: '56.25%', // 16:9
},
expand: {
transform: 'rotate(0deg)',
marginLeft: 'auto',
transition: theme.transitions.create('transform', {
duration: theme.transitions.duration.shortest,
}),
},
expandOpen: {
transform: 'rotate(180deg)',
},
avatar: {
backgroundColor: red[500],
},
const ExpandMore = styled((props) => {
const { expand, ...other } = props;
return <IconButton {...other} />;
})(({ theme, expand }) => ({
transform: !expand ? 'rotate(0deg)' : 'rotate(180deg)',
marginLeft: 'auto',
transition: theme.transitions.create('transform', {
duration: theme.transitions.duration.shortest,
}),
}));

export default function RecipeReviewCard() {
const classes = useStyles();
const [expanded, setExpanded] = React.useState(false);

const handleExpandClick = () => {
setExpanded(!expanded);
};

return (
<Card className={classes.root}>
<Card sx={{ maxWidth: 345 }}>
<CardHeader
avatar={
<Avatar aria-label="recipe" className={classes.avatar}>
<Avatar sx={{ bgcolor: red[500] }} aria-label="recipe">
R
</Avatar>
}
@@ -64,12 +50,15 @@ export default function RecipeReviewCard() {
subheader="September 14, 2016"
/>
<CardMedia
className={classes.media}
sx={{
height: 0,
paddingTop: '56.25%', // 16:9
}}
image="/static/images/cards/paella.jpg"
title="Paella dish"
/>
<CardContent>
<Typography variant="body2" color="textSecondary" component="p">
<Typography variant="body2" color="text.secondary">
This impressive paella is a perfect party dish and a fun meal to cook
together with your guests. Add 1 cup of frozen peas along with the mussels,
if you like.
@@ -82,16 +71,14 @@ export default function RecipeReviewCard() {
<IconButton aria-label="share">
<ShareIcon />
</IconButton>
<IconButton
className={clsx(classes.expand, {
[classes.expandOpen]: expanded,
})}
<ExpandMore
expand={expanded}
onClick={handleExpandClick}
aria-expanded={expanded}
aria-label="show more"
>
<ExpandMoreIcon />
</IconButton>
</ExpandMore>
</CardActions>
<Collapse in={expanded} timeout="auto" unmountOnExit>
<CardContent>
61 changes: 25 additions & 36 deletions docs/src/pages/components/cards/RecipeReviewCard.tsx
Original file line number Diff line number Diff line change
@@ -1,59 +1,47 @@
import * as React from 'react';
import { makeStyles, Theme, createStyles } from '@material-ui/core/styles';
import clsx from 'clsx';
import { experimentalStyled as styled } from '@material-ui/core/styles';
import Card from '@material-ui/core/Card';
import CardHeader from '@material-ui/core/CardHeader';
import CardMedia from '@material-ui/core/CardMedia';
import CardContent from '@material-ui/core/CardContent';
import CardActions from '@material-ui/core/CardActions';
import Collapse from '@material-ui/core/Collapse';
import Avatar from '@material-ui/core/Avatar';
import IconButton from '@material-ui/core/IconButton';
import IconButton, { IconButtonProps } from '@material-ui/core/IconButton';
import Typography from '@material-ui/core/Typography';
import { red } from '@material-ui/core/colors';
import FavoriteIcon from '@material-ui/icons/Favorite';
import ShareIcon from '@material-ui/icons/Share';
import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
import MoreVertIcon from '@material-ui/icons/MoreVert';

const useStyles = makeStyles((theme: Theme) =>
createStyles({
root: {
maxWidth: 345,
},
media: {
height: 0,
paddingTop: '56.25%', // 16:9
},
expand: {
transform: 'rotate(0deg)',
marginLeft: 'auto',
transition: theme.transitions.create('transform', {
duration: theme.transitions.duration.shortest,
}),
},
expandOpen: {
transform: 'rotate(180deg)',
},
avatar: {
backgroundColor: red[500],
},
interface ExpandMoreProps extends IconButtonProps {
expand: boolean;
}

const ExpandMore = styled((props: ExpandMoreProps) => {
const { expand, ...other } = props;
return <IconButton {...other} />;
})(({ theme, expand }) => ({
transform: !expand ? 'rotate(0deg)' : 'rotate(180deg)',
marginLeft: 'auto',
transition: theme.transitions.create('transform', {
duration: theme.transitions.duration.shortest,
}),
);
}));

export default function RecipeReviewCard() {
const classes = useStyles();
const [expanded, setExpanded] = React.useState(false);

const handleExpandClick = () => {
setExpanded(!expanded);
};

return (
<Card className={classes.root}>
<Card sx={{ maxWidth: 345 }}>
<CardHeader
avatar={
<Avatar aria-label="recipe" className={classes.avatar}>
<Avatar sx={{ bgcolor: red[500] }} aria-label="recipe">
R
</Avatar>
}
@@ -66,12 +54,15 @@ export default function RecipeReviewCard() {
subheader="September 14, 2016"
/>
<CardMedia
className={classes.media}
sx={{
height: 0,
paddingTop: '56.25%', // 16:9
}}
image="/static/images/cards/paella.jpg"
title="Paella dish"
/>
<CardContent>
<Typography variant="body2" color="textSecondary" component="p">
<Typography variant="body2" color="text.secondary">
This impressive paella is a perfect party dish and a fun meal to cook
together with your guests. Add 1 cup of frozen peas along with the mussels,
if you like.
@@ -84,16 +75,14 @@ export default function RecipeReviewCard() {
<IconButton aria-label="share">
<ShareIcon />
</IconButton>
<IconButton
className={clsx(classes.expand, {
[classes.expandOpen]: expanded,
})}
<ExpandMore
expand={expanded}
onClick={handleExpandClick}
aria-expanded={expanded}
aria-label="show more"
>
<ExpandMoreIcon />
</IconButton>
</ExpandMore>
</CardActions>
<Collapse in={expanded} timeout="auto" unmountOnExit>
<CardContent>
4 changes: 2 additions & 2 deletions docs/src/pages/components/cards/cards.md
Original file line number Diff line number Diff line change
@@ -15,11 +15,11 @@ They should be easy to scan for relevant and actionable information. Elements, l

{{"component": "modules/components/ComponentLinkHeader.js"}}

## Simple card
## Basic card

Although cards can support multiple actions, UI controls, and an overflow menu, use restraint and remember that cards are entry points to more complex and detailed information.

{{"demo": "pages/components/cards/SimpleCard.js", "bg": true}}
{{"demo": "pages/components/cards/BasicCard.js", "bg": true}}

### Outlined Card

Original file line number Diff line number Diff line change
@@ -27,10 +27,10 @@ describe('<BackdropUnstyled />', () => {
let theme = null;

const Root = React.forwardRef(
({ styleProps: stylePropsProp, theme: themeProp, ...rest }, ref) => {
({ styleProps: stylePropsProp, theme: themeProp, ...other }, ref) => {
styleProps = stylePropsProp;
theme = themeProp;
return <span ref={ref} {...rest} />;
return <span ref={ref} {...other} />;
},
);

Original file line number Diff line number Diff line change
@@ -27,10 +27,10 @@ describe('<BadgeUnstyled />', () => {
let theme = null;

const Root = React.forwardRef(
({ styleProps: stylePropsProp, theme: themeProp, ...rest }, ref) => {
({ styleProps: stylePropsProp, theme: themeProp, ...other }, ref) => {
styleProps = stylePropsProp;
theme = themeProp;
return <span ref={ref} {...rest} />;
return <span ref={ref} {...other} />;
},
);

Original file line number Diff line number Diff line change
@@ -37,10 +37,10 @@ describe('<ModalUnstyled />', () => {
let theme = null;

const Root = React.forwardRef(
({ styleProps: stylePropsProp, theme: themeProp, ...rest }, ref) => {
({ styleProps: stylePropsProp, theme: themeProp, ...other }, ref) => {
styleProps = stylePropsProp;
theme = themeProp;
return <span ref={ref} {...rest} />;
return <span ref={ref} {...other} />;
},
);

4 changes: 2 additions & 2 deletions packages/material-ui-utils/src/integerPropType.js
Original file line number Diff line number Diff line change
@@ -46,14 +46,14 @@ function requiredInteger(props, propName, componentName, location) {
return null;
}

function validator(props, propName, ...rest) {
function validator(props, propName, ...other) {
const propValue = props[propName];

if (propValue === undefined) {
return null;
}

return requiredInteger(props, propName, ...rest);
return requiredInteger(props, propName, ...other);
}

function validatorNoop() {
4 changes: 2 additions & 2 deletions packages/material-ui/src/StepContent/StepContent.test.js
Original file line number Diff line number Diff line change
@@ -24,12 +24,12 @@ describe('<StepContent />', () => {
muiName: 'MuiStepContent',
refInstanceof: window.HTMLDivElement,
render: (node) => {
const { container, ...rest } = render(
const { container, ...other } = render(
<Stepper orientation="vertical">
<Step>{node}</Step>
</Stepper>,
);
return { container: container.firstChild.firstChild, ...rest };
return { container: container.firstChild.firstChild, ...other };
},
skip: ['componentProp', 'componentsProp', 'themeVariants', 'reactTestRenderer'],
}));
4 changes: 2 additions & 2 deletions packages/material-ui/src/TableBody/TableBody.test.js
Original file line number Diff line number Diff line change
@@ -21,8 +21,8 @@ describe('<TableBody />', () => {
return wrapper.find('table').childAt(0);
},
render: (node) => {
const { container, ...rest } = render(<table>{node}</table>);
return { container: container.firstChild, ...rest };
const { container, ...other } = render(<table>{node}</table>);
return { container: container.firstChild, ...other };
},
muiName: 'MuiTableBody',
testVariantProps: { variant: 'foo' },
4 changes: 2 additions & 2 deletions packages/material-ui/src/TableCell/TableCell.test.js
Original file line number Diff line number Diff line change
@@ -21,14 +21,14 @@ describe('<TableCell />', () => {
classes,
inheritComponent: 'td',
render: (node) => {
const { container, ...rest } = render(
const { container, ...other } = render(
<table>
<tbody>
<tr>{node}</tr>
</tbody>
</table>,
);
return { container: container.firstChild.firstChild.firstChild, ...rest };
return { container: container.firstChild.firstChild.firstChild, ...other };
},
mount: (node) => {
const wrapper = mount(
4 changes: 2 additions & 2 deletions packages/material-ui/src/TableFooter/TableFooter.test.js
Original file line number Diff line number Diff line change
@@ -17,8 +17,8 @@ describe('<TableFooter />', () => {
classes,
inheritComponent: 'tfoot',
render: (node) => {
const { container, ...rest } = render(<table>{node}</table>);
return { container: container.firstChild, ...rest };
const { container, ...other } = render(<table>{node}</table>);
return { container: container.firstChild, ...other };
},
mount: (node) => {
const wrapper = mount(<table>{node}</table>);
4 changes: 2 additions & 2 deletions packages/material-ui/src/TableHead/TableHead.test.js
Original file line number Diff line number Diff line change
@@ -20,8 +20,8 @@ describe('<TableHead />', () => {
return wrapper.find('table').childAt(0);
},
render: (node) => {
const { container, ...rest } = render(<table>{node}</table>);
return { container: container.firstChild, ...rest };
const { container, ...other } = render(<table>{node}</table>);
return { container: container.firstChild, ...other };
},
muiName: 'MuiTableHead',
testVariantProps: { variant: 'foo' },
4 changes: 2 additions & 2 deletions packages/material-ui/src/TableRow/TableRow.test.js
Original file line number Diff line number Diff line change
@@ -20,12 +20,12 @@ describe('<TableRow />', () => {
classes,
inheritComponent: 'tr',
render: (node) => {
const { container, ...rest } = render(
const { container, ...other } = render(
<table>
<tbody>{node}</tbody>
</table>,
);
return { container: container.firstChild.firstChild, ...rest };
return { container: container.firstChild.firstChild, ...other };
},
mount: (node) => {
const wrapper = mount(