@@ -47,8 +46,4 @@ function FullWidthGrid(props) {
);
}
-FullWidthGrid.propTypes = {
- classes: PropTypes.object.isRequired,
-};
-
-export default withStyles(styles)(FullWidthGrid);
+export default FullWidthGrid;
diff --git a/docs/src/pages/components/grid/FullWidthGrid.tsx b/docs/src/pages/components/grid/FullWidthGrid.tsx
new file mode 100644
index 00000000000000..cec133592850ed
--- /dev/null
+++ b/docs/src/pages/components/grid/FullWidthGrid.tsx
@@ -0,0 +1,51 @@
+import React from 'react';
+import { makeStyles, createStyles, Theme } from '@material-ui/core/styles';
+import Paper from '@material-ui/core/Paper';
+import Grid from '@material-ui/core/Grid';
+
+const useStyles = makeStyles((theme: Theme) =>
+ createStyles({
+ root: {
+ flexGrow: 1,
+ },
+ paper: {
+ padding: theme.spacing(2),
+ textAlign: 'center',
+ color: theme.palette.text.secondary,
+ },
+ }),
+);
+
+function FullWidthGrid() {
+ const classes = useStyles();
+
+ return (
+
+
+
+ xs=12
+
+
+ xs=12 sm=6
+
+
+ xs=12 sm=6
+
+
+ xs=6 sm=3
+
+
+ xs=6 sm=3
+
+
+ xs=6 sm=3
+
+
+ xs=6 sm=3
+
+
+
+ );
+}
+
+export default FullWidthGrid;
diff --git a/docs/src/pages/components/grid/InteractiveGrid.js b/docs/src/pages/components/grid/InteractiveGrid.js
index 1bc27d01aac017..cf70ffe54d8b6a 100644
--- a/docs/src/pages/components/grid/InteractiveGrid.js
+++ b/docs/src/pages/components/grid/InteractiveGrid.js
@@ -1,7 +1,4 @@
import React from 'react';
-import PropTypes from 'prop-types';
-import { withStyles } from '@material-ui/core/styles';
-import MarkdownElement from 'docs/src/modules/components/MarkdownElement';
import Grid from '@material-ui/core/Grid';
import FormControl from '@material-ui/core/FormControl';
import FormLabel from '@material-ui/core/FormLabel';
@@ -9,8 +6,13 @@ import FormControlLabel from '@material-ui/core/FormControlLabel';
import RadioGroup from '@material-ui/core/RadioGroup';
import Radio from '@material-ui/core/Radio';
import Paper from '@material-ui/core/Paper';
+import { makeStyles } from '@material-ui/core/styles';
+// We don't have a typescript version of MarkdownElement
+// tslint:disable-next-line: ban-ts-ignore
+// @ts-ignore
+import MarkdownElement from 'docs/src/modules/components/MarkdownElement';
-const styles = theme => ({
+const useStyles = makeStyles(theme => ({
root: {
flexGrow: 1,
},
@@ -25,26 +27,15 @@ const styles = theme => ({
control: {
padding: theme.spacing(2),
},
-});
-
-class InteractiveGrid extends React.Component {
- state = {
- direction: 'row',
- justify: 'center',
- alignItems: 'center',
- };
+}));
- handleChange = key => (event, value) => {
- this.setState({
- [key]: value,
- });
- };
+function InteractiveGrid() {
+ const classes = useStyles();
+ const [direction, setDirection] = React.useState('row');
+ const [justify, setJustify] = React.useState('center');
+ const [alignItems, setAlignItems] = React.useState('center');
- render() {
- const { classes } = this.props;
- const { alignItems, direction, justify } = this.state;
-
- const code = `
+ const code = `
\`\`\`jsx
-
-
- {[0, 1, 2].map(value => (
-
-
- {`Cell ${value + 1}`}
-
-
- ))}
-
-
-
-
-
-
-
- direction
-
- } label="row" />
- } label="row-reverse" />
- } label="column" />
- }
- label="column-reverse"
- />
-
-
-
-
-
- justify
-
- } label="flex-start" />
- } label="center" />
- } label="flex-end" />
- }
- label="space-between"
- />
- }
- label="space-around"
- />
- }
- label="space-evenly"
- />
-
-
-
-
-
- alignItems
-
- } label="flex-start" />
- } label="center" />
- } label="flex-end" />
- } label="stretch" />
- } label="baseline" />
-
-
-
+ return (
+
+
+
+ {[0, 1, 2].map(value => (
+
+
+ {`Cell ${value + 1}`}
+
-
-
-
-
+ ))}
- );
- }
+
+
+
+
+
+ direction
+ setDirection(value)}
+ >
+ } label="row" />
+ } label="row-reverse" />
+ } label="column" />
+ }
+ label="column-reverse"
+ />
+
+
+
+
+
+ justify
+ setJustify(value)}
+ >
+ } label="flex-start" />
+ } label="center" />
+ } label="flex-end" />
+ }
+ label="space-between"
+ />
+ } label="space-around" />
+ } label="space-evenly" />
+
+
+
+
+
+ alignItems
+ setAlignItems(value)}
+ >
+ } label="flex-start" />
+ } label="center" />
+ } label="flex-end" />
+ } label="stretch" />
+ } label="baseline" />
+
+
+
+
+
+
+
+
+
+
+ );
}
-InteractiveGrid.propTypes = {
- classes: PropTypes.object.isRequired,
-};
-
-export default withStyles(styles)(InteractiveGrid);
+export default InteractiveGrid;
diff --git a/docs/src/pages/components/grid/InteractiveGrid.tsx b/docs/src/pages/components/grid/InteractiveGrid.tsx
new file mode 100644
index 00000000000000..f9e4fe338aa4ed
--- /dev/null
+++ b/docs/src/pages/components/grid/InteractiveGrid.tsx
@@ -0,0 +1,149 @@
+import React from 'react';
+import Grid, { GridItemsAlignment, GridJustification, GridDirection } from '@material-ui/core/Grid';
+import FormControl from '@material-ui/core/FormControl';
+import FormLabel from '@material-ui/core/FormLabel';
+import FormControlLabel from '@material-ui/core/FormControlLabel';
+import RadioGroup from '@material-ui/core/RadioGroup';
+import Radio from '@material-ui/core/Radio';
+import Paper from '@material-ui/core/Paper';
+import { makeStyles, createStyles, Theme } from '@material-ui/core/styles';
+// We don't have a typescript version of MarkdownElement
+// tslint:disable-next-line: ban-ts-ignore
+// @ts-ignore
+import MarkdownElement from 'docs/src/modules/components/MarkdownElement';
+
+const useStyles = makeStyles((theme: Theme) =>
+ createStyles({
+ root: {
+ flexGrow: 1,
+ },
+ demo: {
+ height: 240,
+ },
+ paper: {
+ padding: theme.spacing(2),
+ height: '100%',
+ color: theme.palette.text.secondary,
+ },
+ control: {
+ padding: theme.spacing(2),
+ },
+ }),
+);
+
+function InteractiveGrid() {
+ const classes = useStyles();
+ const [direction, setDirection] = React.useState
('row');
+ const [justify, setJustify] = React.useState('center');
+ const [alignItems, setAlignItems] = React.useState('center');
+
+ const code = `
+\`\`\`jsx
+
+\`\`\`
+`;
+
+ return (
+
+
+
+ {[0, 1, 2].map(value => (
+
+
+ {`Cell ${value + 1}`}
+
+
+ ))}
+
+
+
+
+
+
+
+ direction
+ setDirection(value as GridDirection)}
+ >
+ } label="row" />
+ } label="row-reverse" />
+ } label="column" />
+ }
+ label="column-reverse"
+ />
+
+
+
+
+
+ justify
+ setJustify(value as GridJustification)}
+ >
+ } label="flex-start" />
+ } label="center" />
+ } label="flex-end" />
+ }
+ label="space-between"
+ />
+ } label="space-around" />
+ } label="space-evenly" />
+
+
+
+
+
+ alignItems
+ setAlignItems(value as GridItemsAlignment)}
+ >
+ } label="flex-start" />
+ } label="center" />
+ } label="flex-end" />
+ } label="stretch" />
+ } label="baseline" />
+
+
+
+
+
+
+
+
+
+
+ );
+}
+
+export default InteractiveGrid;
diff --git a/docs/src/pages/components/grid/NestedGrid.js b/docs/src/pages/components/grid/NestedGrid.js
index 08b0747cec2e83..07a316efe546ea 100644
--- a/docs/src/pages/components/grid/NestedGrid.js
+++ b/docs/src/pages/components/grid/NestedGrid.js
@@ -1,10 +1,9 @@
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 Grid from '@material-ui/core/Grid';
-const styles = theme => ({
+const useStyles = makeStyles(theme => ({
root: {
flexGrow: 1,
},
@@ -13,52 +12,42 @@ const styles = theme => ({
textAlign: 'center',
color: theme.palette.text.secondary,
},
-});
+}));
-function FormRow(props) {
- const { classes } = props;
+function NestedGrid() {
+ const classes = useStyles();
- return (
-
-
- item
-
-
- item
-
-
- item
-
-
- );
-}
-
-FormRow.propTypes = {
- classes: PropTypes.object.isRequired,
-};
-
-function NestedGrid(props) {
- const { classes } = props;
+ function FormRow() {
+ return (
+
+
+ item
+
+
+ item
+
+
+ item
+
+
+ );
+ }
return (
-
+
-
+
-
+
);
}
-NestedGrid.propTypes = {
- classes: PropTypes.object.isRequired,
-};
-
-export default withStyles(styles)(NestedGrid);
+export default NestedGrid;
diff --git a/docs/src/pages/components/grid/NestedGrid.tsx b/docs/src/pages/components/grid/NestedGrid.tsx
new file mode 100644
index 00000000000000..674bc984207afb
--- /dev/null
+++ b/docs/src/pages/components/grid/NestedGrid.tsx
@@ -0,0 +1,55 @@
+import React from 'react';
+import { makeStyles, createStyles, Theme } from '@material-ui/core/styles';
+import Paper from '@material-ui/core/Paper';
+import Grid from '@material-ui/core/Grid';
+
+const useStyles = makeStyles((theme: Theme) =>
+ createStyles({
+ root: {
+ flexGrow: 1,
+ },
+ paper: {
+ padding: theme.spacing(1),
+ textAlign: 'center',
+ color: theme.palette.text.secondary,
+ },
+ }),
+);
+
+function NestedGrid() {
+ const classes = useStyles();
+
+ function FormRow() {
+ return (
+
+
+ item
+
+
+ item
+
+
+ item
+
+
+ );
+ }
+
+ return (
+
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+}
+
+export default NestedGrid;
diff --git a/docs/src/pages/components/grid/SpacingGrid.js b/docs/src/pages/components/grid/SpacingGrid.js
index 3c419995e4e1c6..c2842de1f6b917 100644
--- a/docs/src/pages/components/grid/SpacingGrid.js
+++ b/docs/src/pages/components/grid/SpacingGrid.js
@@ -1,6 +1,5 @@
import React from 'react';
-import PropTypes from 'prop-types';
-import { withStyles } from '@material-ui/core/styles';
+import { makeStyles } from '@material-ui/core/styles';
import Grid from '@material-ui/core/Grid';
import FormLabel from '@material-ui/core/FormLabel';
import FormControlLabel from '@material-ui/core/FormControlLabel';
@@ -8,7 +7,7 @@ import RadioGroup from '@material-ui/core/RadioGroup';
import Radio from '@material-ui/core/Radio';
import Paper from '@material-ui/core/Paper';
-const styles = theme => ({
+const useStyles = makeStyles(theme => ({
root: {
flexGrow: 1,
},
@@ -19,69 +18,54 @@ const styles = theme => ({
control: {
padding: theme.spacing(2),
},
-});
+}));
-class GuttersGrid extends React.Component {
- state = {
- spacing: '2',
- };
+function SpacingGrid() {
+ const [spacing, setSpacing] = React.useState(2);
+ const classes = useStyles();
- handleChange = key => (event, value) => {
- this.setState({
- [key]: value,
- });
- };
-
- render() {
- const { classes } = this.props;
- const { spacing } = this.state;
+ function handleChange(event, value) {
+ setSpacing(Number(value));
+ }
- return (
-
-
-
- {[0, 1, 2].map(value => (
-
-
-
- ))}
-
-
-
-
-
-
- spacing
-
- } label="0" />
- } label="1" />
- } label="2" />
- } label="3" />
- } label="4" />
- } label="5" />
- } label="6" />
- } label="7" />
- } label="8" />
- } label="9" />
- } label="10" />
-
-
+ return (
+
+
+
+ {[0, 1, 2].map(value => (
+
+
-
+ ))}
- );
- }
+
+
+
+
+ spacing
+
+ {[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10].map(value => (
+ }
+ label={value.toString()}
+ />
+ ))}
+
+
+
+
+
+
+ );
}
-GuttersGrid.propTypes = {
- classes: PropTypes.object.isRequired,
-};
-
-export default withStyles(styles)(GuttersGrid);
+export default SpacingGrid;
diff --git a/docs/src/pages/components/grid/SpacingGrid.tsx b/docs/src/pages/components/grid/SpacingGrid.tsx
new file mode 100644
index 00000000000000..62ad9d8375f7e2
--- /dev/null
+++ b/docs/src/pages/components/grid/SpacingGrid.tsx
@@ -0,0 +1,73 @@
+import React from 'react';
+import { makeStyles, createStyles, Theme } from '@material-ui/core/styles';
+import Grid, { GridSpacing } from '@material-ui/core/Grid';
+import FormLabel from '@material-ui/core/FormLabel';
+import FormControlLabel from '@material-ui/core/FormControlLabel';
+import RadioGroup from '@material-ui/core/RadioGroup';
+import Radio from '@material-ui/core/Radio';
+import Paper from '@material-ui/core/Paper';
+
+const useStyles = makeStyles((theme: Theme) =>
+ createStyles({
+ root: {
+ flexGrow: 1,
+ },
+ paper: {
+ height: 140,
+ width: 100,
+ },
+ control: {
+ padding: theme.spacing(2),
+ },
+ }),
+);
+
+function SpacingGrid() {
+ const [spacing, setSpacing] = React.useState(2);
+ const classes = useStyles();
+
+ function handleChange(event: any, value: string) {
+ setSpacing(Number(value) as GridSpacing);
+ }
+
+ return (
+
+
+
+ {[0, 1, 2].map(value => (
+
+
+
+ ))}
+
+
+
+
+
+
+ spacing
+
+ {[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10].map(value => (
+ }
+ label={value.toString()}
+ />
+ ))}
+
+
+
+
+
+
+ );
+}
+
+export default SpacingGrid;