Skip to content

Commit

Permalink
[docs] Migrate Paper demos to hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
merceyz committed Apr 25, 2019
1 parent 1155be4 commit 2d5cebc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 22 deletions.
17 changes: 6 additions & 11 deletions docs/src/pages/demos/paper/PaperSheet.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
import React from 'react';
import PropTypes from 'prop-types';
import { withStyles } from '@material-ui/core/styles';
import { makeStyles } from '@material-ui/core/styles';
import Paper from '@material-ui/core/Paper';
import Typography from '@material-ui/core/Typography';

const styles = theme => ({
const useStyles = makeStyles(theme => ({
root: {
padding: theme.spacing(3, 2),
},
});
}));

function PaperSheet(props) {
const { classes } = props;
function PaperSheet() {
const classes = useStyles();

return (
<div>
Expand All @@ -27,8 +26,4 @@ function PaperSheet(props) {
);
}

PaperSheet.propTypes = {
classes: PropTypes.object.isRequired,
};

export default withStyles(styles)(PaperSheet);
export default PaperSheet;
18 changes: 7 additions & 11 deletions docs/src/pages/demos/paper/PaperSheet.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import React from 'react';
import PropTypes from 'prop-types';
import { withStyles, Theme, createStyles, WithStyles } from '@material-ui/core/styles';
import { Theme, createStyles, makeStyles } from '@material-ui/core/styles';
import Paper from '@material-ui/core/Paper';
import Typography from '@material-ui/core/Typography';

const styles = (theme: Theme) =>
const useStyles = makeStyles((theme: Theme) =>
createStyles({
root: {
padding: theme.spacing(3, 2),
},
});
}),
);

function PaperSheet(props: WithStyles<typeof styles>) {
const { classes } = props;
function PaperSheet() {
const classes = useStyles();

return (
<div>
Expand All @@ -28,8 +28,4 @@ function PaperSheet(props: WithStyles<typeof styles>) {
);
}

PaperSheet.propTypes = {
classes: PropTypes.object.isRequired,
} as any;

export default withStyles(styles)(PaperSheet);
export default PaperSheet;

0 comments on commit 2d5cebc

Please sign in to comment.