@@ -82,8 +70,4 @@ function CustomizedBreadcrumbs(props: CustomizedBreadcrumbsProps) {
);
}
-CustomizedBreadcrumbs.propTypes = {
- classes: PropTypes.object.isRequired,
-} as any;
-
-export default withStyles(styles)(CustomizedBreadcrumbs);
+export default CustomizedBreadcrumbs;
diff --git a/docs/src/pages/demos/buttons/CustomizedButtons.js b/docs/src/pages/demos/buttons/CustomizedButtons.js
index d3501258fc5b47..4e75592ea01412 100644
--- a/docs/src/pages/demos/buttons/CustomizedButtons.js
+++ b/docs/src/pages/demos/buttons/CustomizedButtons.js
@@ -1,23 +1,12 @@
import React from 'react';
-import clsx from 'clsx';
-import { createMuiTheme, makeStyles } from '@material-ui/core/styles';
+import { createMuiTheme, withStyles, makeStyles } from '@material-ui/core/styles';
import { ThemeProvider } from '@material-ui/styles';
import Button from '@material-ui/core/Button';
import purple from '@material-ui/core/colors/purple';
import green from '@material-ui/core/colors/green';
-const useStyles = makeStyles(theme => ({
- margin: {
- margin: theme.spacing(1),
- },
- cssRoot: {
- color: theme.palette.getContrastText(purple[500]),
- backgroundColor: purple[500],
- '&:hover': {
- backgroundColor: purple[700],
- },
- },
- bootstrapRoot: {
+const BootstrapButton = withStyles({
+ root: {
boxShadow: 'none',
textTransform: 'none',
fontSize: 16,
@@ -51,6 +40,22 @@ const useStyles = makeStyles(theme => ({
boxShadow: '0 0 0 0.2rem rgba(0,123,255,.5)',
},
},
+})(Button);
+
+const ColorButton = withStyles(theme => ({
+ root: {
+ color: theme.palette.getContrastText(purple[500]),
+ backgroundColor: purple[500],
+ '&:hover': {
+ backgroundColor: purple[700],
+ },
+ },
+}))(Button);
+
+const useStyles = makeStyles(theme => ({
+ margin: {
+ margin: theme.spacing(1),
+ },
}));
const theme = createMuiTheme({
@@ -64,22 +69,17 @@ function CustomizedButtons() {
return (
-
+
Custom CSS
-
+
- ThemeProvider
+ Theme Provider
-
+
Bootstrap
-
+
);
}
diff --git a/docs/src/pages/demos/buttons/CustomizedButtons.tsx b/docs/src/pages/demos/buttons/CustomizedButtons.tsx
index 0cd4aa9c120f14..e614ade196698e 100644
--- a/docs/src/pages/demos/buttons/CustomizedButtons.tsx
+++ b/docs/src/pages/demos/buttons/CustomizedButtons.tsx
@@ -1,57 +1,68 @@
import React from 'react';
-import clsx from 'clsx';
-import { createMuiTheme, createStyles, makeStyles, Theme } from '@material-ui/core/styles';
+import {
+ createMuiTheme,
+ createStyles,
+ withStyles,
+ makeStyles,
+ Theme,
+} from '@material-ui/core/styles';
import { ThemeProvider } from '@material-ui/styles';
import Button from '@material-ui/core/Button';
import purple from '@material-ui/core/colors/purple';
import green from '@material-ui/core/colors/green';
+const BootstrapButton = withStyles({
+ root: {
+ boxShadow: 'none',
+ textTransform: 'none',
+ fontSize: 16,
+ padding: '6px 12px',
+ border: '1px solid',
+ lineHeight: 1.5,
+ backgroundColor: '#007bff',
+ borderColor: '#007bff',
+ fontFamily: [
+ '-apple-system',
+ 'BlinkMacSystemFont',
+ '"Segoe UI"',
+ 'Roboto',
+ '"Helvetica Neue"',
+ 'Arial',
+ 'sans-serif',
+ '"Apple Color Emoji"',
+ '"Segoe UI Emoji"',
+ '"Segoe UI Symbol"',
+ ].join(','),
+ '&:hover': {
+ backgroundColor: '#0069d9',
+ borderColor: '#0062cc',
+ },
+ '&:active': {
+ boxShadow: 'none',
+ backgroundColor: '#0062cc',
+ borderColor: '#005cbf',
+ },
+ '&:focus': {
+ boxShadow: '0 0 0 0.2rem rgba(0,123,255,.5)',
+ },
+ },
+})(Button);
+
+const ColorButton = withStyles((theme: Theme) => ({
+ root: {
+ color: theme.palette.getContrastText(purple[500]),
+ backgroundColor: purple[500],
+ '&:hover': {
+ backgroundColor: purple[700],
+ },
+ },
+}))(Button);
+
const useStyles = makeStyles((theme: Theme) =>
createStyles({
margin: {
margin: theme.spacing(1),
},
- cssRoot: {
- color: theme.palette.getContrastText(purple[500]),
- backgroundColor: purple[500],
- '&:hover': {
- backgroundColor: purple[700],
- },
- },
- bootstrapRoot: {
- boxShadow: 'none',
- textTransform: 'none',
- fontSize: 16,
- padding: '6px 12px',
- border: '1px solid',
- lineHeight: 1.5,
- backgroundColor: '#007bff',
- borderColor: '#007bff',
- fontFamily: [
- '-apple-system',
- 'BlinkMacSystemFont',
- '"Segoe UI"',
- 'Roboto',
- '"Helvetica Neue"',
- 'Arial',
- 'sans-serif',
- '"Apple Color Emoji"',
- '"Segoe UI Emoji"',
- '"Segoe UI Symbol"',
- ].join(','),
- '&:hover': {
- backgroundColor: '#0069d9',
- borderColor: '#0062cc',
- },
- '&:active': {
- boxShadow: 'none',
- backgroundColor: '#0062cc',
- borderColor: '#005cbf',
- },
- '&:focus': {
- boxShadow: '0 0 0 0.2rem rgba(0,123,255,.5)',
- },
- },
}),
);
@@ -66,22 +77,17 @@ function CustomizedButtons() {
return (
-
+
Custom CSS
-
+
- ThemeProvider
+ Theme Provider
-
+
Bootstrap
-
+
);
}
diff --git a/docs/src/pages/demos/dialogs/CustomizedDialog.tsx b/docs/src/pages/demos/dialogs/CustomizedDialog.tsx
index d50f5ffc9f1a06..e3cdad3b061004 100644
--- a/docs/src/pages/demos/dialogs/CustomizedDialog.tsx
+++ b/docs/src/pages/demos/dialogs/CustomizedDialog.tsx
@@ -43,13 +43,13 @@ const DialogTitle = withStyles(styles)((props: DialogTitleProps) => {
);
});
-const DialogContent = withStyles(theme => ({
+const DialogContent = withStyles((theme: Theme) => ({
root: {
padding: theme.spacing(2),
},
}))(MuiDialogContent);
-const DialogActions = withStyles(theme => ({
+const DialogActions = withStyles((theme: Theme) => ({
root: {
margin: 0,
padding: theme.spacing(1),
diff --git a/docs/src/pages/demos/expansion-panels/CustomizedExpansionPanel.js b/docs/src/pages/demos/expansion-panels/CustomizedExpansionPanel.js
index 3ec84239dd63e9..750b3f955f1e00 100644
--- a/docs/src/pages/demos/expansion-panels/CustomizedExpansionPanel.js
+++ b/docs/src/pages/demos/expansion-panels/CustomizedExpansionPanel.js
@@ -7,7 +7,7 @@ import Typography from '@material-ui/core/Typography';
const ExpansionPanel = withStyles({
root: {
- border: '1px solid rgba(0,0,0,.125)',
+ border: '1px solid rgba(0, 0, 0, .125)',
boxShadow: 'none',
'&:not(:last-child)': {
borderBottom: 0,
@@ -15,16 +15,17 @@ const ExpansionPanel = withStyles({
'&:before': {
display: 'none',
},
+ '&$expanded': {
+ margin: 'auto',
+ },
},
- expanded: {
- margin: 'auto',
- },
+ expanded: {},
})(MuiExpansionPanel);
const ExpansionPanelSummary = withStyles({
root: {
- backgroundColor: 'rgba(0,0,0,.03)',
- borderBottom: '1px solid rgba(0,0,0,.125)',
+ backgroundColor: 'rgba(0, 0, 0, .03)',
+ borderBottom: '1px solid rgba(0, 0, 0, .125)',
marginBottom: -1,
minHeight: 56,
'&$expanded': {
@@ -45,72 +46,53 @@ const ExpansionPanelDetails = withStyles(theme => ({
},
}))(MuiExpansionPanelDetails);
-class CustomizedExpansionPanel extends React.Component {
- state = {
- expanded: 'panel1',
- };
+function CustomizedExpansionPanel() {
+ const [expanded, setExpanded] = React.useState('panel1');
- handleChange = panel => (event, expanded) => {
- this.setState({
- expanded: expanded ? panel : false,
- });
+ const handleChange = panel => (event, newExpanded) => {
+ setExpanded(newExpanded ? panel : false);
};
- render() {
- const { expanded } = this.state;
- return (
-
-
-
-
-
- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus
- ex, sit amet blandit leo lobortis eget. Lorem ipsum dolor sit amet, consectetur
- adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget.
-
-
-
-
-
-
-
- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus
- ex, sit amet blandit leo lobortis eget. Lorem ipsum dolor sit amet, consectetur
- adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget.
-
-
-
-
-
-
-
- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus
- ex, sit amet blandit leo lobortis eget. Lorem ipsum dolor sit amet, consectetur
- adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget.
-
-
-
-
- );
- }
+ return (
+
+
+
+
+
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex,
+ sit amet blandit leo lobortis eget. Lorem ipsum dolor sit amet, consectetur adipiscing
+ elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget.
+
+
+
+
+
+
+
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex,
+ sit amet blandit leo lobortis eget. Lorem ipsum dolor sit amet, consectetur adipiscing
+ elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget.
+
+
+
+
+
+
+
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex,
+ sit amet blandit leo lobortis eget. Lorem ipsum dolor sit amet, consectetur adipiscing
+ elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget.
+
+
+
+
+ );
}
export default CustomizedExpansionPanel;
diff --git a/docs/src/pages/demos/expansion-panels/CustomizedExpansionPanel.tsx b/docs/src/pages/demos/expansion-panels/CustomizedExpansionPanel.tsx
index b3d7d5ec285182..e8f59085b417d8 100644
--- a/docs/src/pages/demos/expansion-panels/CustomizedExpansionPanel.tsx
+++ b/docs/src/pages/demos/expansion-panels/CustomizedExpansionPanel.tsx
@@ -7,7 +7,7 @@ import Typography from '@material-ui/core/Typography';
const ExpansionPanel = withStyles({
root: {
- border: '1px solid rgba(0,0,0,.125)',
+ border: '1px solid rgba(0, 0, 0, .125)',
boxShadow: 'none',
'&:not(:last-child)': {
borderBottom: 0,
@@ -15,16 +15,17 @@ const ExpansionPanel = withStyles({
'&:before': {
display: 'none',
},
+ '&$expanded': {
+ margin: 'auto',
+ },
},
- expanded: {
- margin: 'auto',
- },
+ expanded: {},
})(MuiExpansionPanel);
const ExpansionPanelSummary = withStyles({
root: {
- backgroundColor: 'rgba(0,0,0,.03)',
- borderBottom: '1px solid rgba(0,0,0,.125)',
+ backgroundColor: 'rgba(0, 0, 0, .03)',
+ borderBottom: '1px solid rgba(0, 0, 0, .125)',
marginBottom: -1,
minHeight: 56,
'&$expanded': {
@@ -49,72 +50,53 @@ interface CustomizedExpansionPanelStates {
expanded: string | boolean;
}
-class CustomizedExpansionPanel extends React.Component<{}, CustomizedExpansionPanelStates> {
- state = {
- expanded: 'panel1',
- };
+function CustomizedExpansionPanel() {
+ const [expanded, setExpanded] = React.useState('panel1');
- handleChange = (panel: string) => (event: React.ChangeEvent<{}>, expanded: boolean) => {
- this.setState({
- expanded: expanded ? panel : false,
- });
+ const handleChange = (panel: string) => (event: React.ChangeEvent<{}>, newExpanded: boolean) => {
+ setExpanded(newExpanded ? panel : false);
};
- render() {
- const { expanded } = this.state;
- return (
-
-
-
-
-
- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus
- ex, sit amet blandit leo lobortis eget. Lorem ipsum dolor sit amet, consectetur
- adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget.
-
-
-
-
-
-
-
- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus
- ex, sit amet blandit leo lobortis eget. Lorem ipsum dolor sit amet, consectetur
- adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget.
-
-
-
-
-
-
-
- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus
- ex, sit amet blandit leo lobortis eget. Lorem ipsum dolor sit amet, consectetur
- adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget.
-
-
-
-
- );
- }
+ return (
+
+
+
+
+
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex,
+ sit amet blandit leo lobortis eget. Lorem ipsum dolor sit amet, consectetur adipiscing
+ elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget.
+
+
+
+
+
+
+
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex,
+ sit amet blandit leo lobortis eget. Lorem ipsum dolor sit amet, consectetur adipiscing
+ elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget.
+
+
+
+
+
+
+
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex,
+ sit amet blandit leo lobortis eget. Lorem ipsum dolor sit amet, consectetur adipiscing
+ elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget.
+
+
+
+
+ );
}
export default CustomizedExpansionPanel;
diff --git a/docs/src/pages/demos/progress/CustomizedProgress.js b/docs/src/pages/demos/progress/CustomizedProgress.js
index 1dc8a6295d7608..2ebd486ca080dd 100644
--- a/docs/src/pages/demos/progress/CustomizedProgress.js
+++ b/docs/src/pages/demos/progress/CustomizedProgress.js
@@ -1,43 +1,44 @@
import React from 'react';
-import PropTypes from 'prop-types';
-import { withStyles } from '@material-ui/core/styles';
+import { makeStyles, withStyles } from '@material-ui/core/styles';
import { lighten } from '@material-ui/core/styles/colorManipulator';
import CircularProgress from '@material-ui/core/CircularProgress';
-import Paper from '@material-ui/core/Paper';
import LinearProgress from '@material-ui/core/LinearProgress';
-const styles = theme => ({
+const ColorCircularProgress = withStyles({
root: {
- flexGrow: 1,
- },
- progress: {
- margin: theme.spacing(2),
color: '#00695c',
},
- linearColorPrimary: {
+})(CircularProgress);
+
+const ColorLinearProgress = withStyles({
+ colorPrimary: {
backgroundColor: '#b2dfdb',
},
- linearBarColorPrimary: {
+ barColorPrimary: {
backgroundColor: '#00695c',
},
- linearProgressDeterminate: {
- margin: `${theme.spacing(1)}px auto 0`,
+})(LinearProgress);
+
+const BorderLinearProgress = withStyles({
+ root: {
height: 10,
backgroundColor: lighten('#ff6c5c', 0.5),
},
- linearProgressDeterminateBar: {
+ bar: {
borderRadius: 20,
backgroundColor: '#ff6c5c',
},
- // Reproduce the Facebook spinners.
- facebook: {
- margin: theme.spacing(2),
+})(LinearProgress);
+
+// Inspired by the Facebook spinners.
+const useStylesFacebook = makeStyles({
+ root: {
position: 'relative',
},
- facebook1: {
+ top: {
color: '#eef3fd',
},
- facebook2: {
+ bottom: {
color: '#6798e5',
animationDuration: '550ms',
position: 'absolute',
@@ -45,49 +46,56 @@ const styles = theme => ({
},
});
-function CustomizedProgress(props) {
- const { classes } = props;
+function FacebookProgress(props) {
+ const classes = useStylesFacebook();
return (
-
-
-
+
-
+
+ );
+}
+
+const useStyles = makeStyles(theme => ({
+ root: {
+ flexGrow: 1,
+ },
+ margin: {
+ margin: theme.spacing(1),
+ },
+}));
+
+function CustomizedProgress() {
+ const classes = useStyles();
+
+ return (
+
);
}
-CustomizedProgress.propTypes = {
- classes: PropTypes.object.isRequired,
-};
-
-export default withStyles(styles)(CustomizedProgress);
+export default CustomizedProgress;
diff --git a/docs/src/pages/demos/progress/CustomizedProgress.tsx b/docs/src/pages/demos/progress/CustomizedProgress.tsx
index b60ef8afd0eda6..f8d2f9ef6ce3d9 100644
--- a/docs/src/pages/demos/progress/CustomizedProgress.tsx
+++ b/docs/src/pages/demos/progress/CustomizedProgress.tsx
@@ -1,96 +1,103 @@
import React from 'react';
-import PropTypes from 'prop-types';
-import { createStyles, withStyles, WithStyles, Theme } from '@material-ui/core/styles';
+import { makeStyles, createStyles, withStyles, WithStyles, Theme } from '@material-ui/core/styles';
import { lighten } from '@material-ui/core/styles/colorManipulator';
-import CircularProgress from '@material-ui/core/CircularProgress';
-import Paper from '@material-ui/core/Paper';
+import CircularProgress, { CircularProgressProps } from '@material-ui/core/CircularProgress';
import LinearProgress from '@material-ui/core/LinearProgress';
-const styles = (theme: Theme) =>
+const ColorCircularProgress = withStyles({
+ root: {
+ color: '#00695c',
+ },
+})(CircularProgress);
+
+const ColorLinearProgress = withStyles({
+ colorPrimary: {
+ backgroundColor: '#b2dfdb',
+ },
+ barColorPrimary: {
+ backgroundColor: '#00695c',
+ },
+})(LinearProgress);
+
+const BorderLinearProgress = withStyles({
+ root: {
+ height: 10,
+ backgroundColor: lighten('#ff6c5c', 0.5),
+ },
+ bar: {
+ borderRadius: 20,
+ backgroundColor: '#ff6c5c',
+ },
+})(LinearProgress);
+
+// Inspired by the Facebook spinners.
+const useStylesFacebook = makeStyles({
+ root: {
+ position: 'relative',
+ },
+ top: {
+ color: '#eef3fd',
+ },
+ bottom: {
+ color: '#6798e5',
+ animationDuration: '550ms',
+ position: 'absolute',
+ left: 0,
+ },
+});
+
+function FacebookProgress(props: CircularProgressProps) {
+ const classes = useStylesFacebook();
+
+ return (
+
+
+
+
+ );
+}
+
+const useStyles = makeStyles((theme: Theme) =>
createStyles({
root: {
flexGrow: 1,
},
- progress: {
- margin: theme.spacing(2),
- color: '#00695c',
- },
- linearColorPrimary: {
- backgroundColor: '#b2dfdb',
- },
- linearBarColorPrimary: {
- backgroundColor: '#00695c',
- },
- linearProgressDeterminate: {
- margin: `${theme.spacing(1)}px auto 0`,
- height: 10,
- backgroundColor: lighten('#ff6c5c', 0.5),
- },
- linearProgressDeterminateBar: {
- borderRadius: 20,
- backgroundColor: '#ff6c5c',
- },
- // Reproduce the Facebook spinners.
- facebook: {
- margin: theme.spacing(2),
- position: 'relative',
+ margin: {
+ margin: theme.spacing(1),
},
- facebook1: {
- color: '#eef3fd',
- },
- facebook2: {
- color: '#6798e5',
- animationDuration: '550ms',
- position: 'absolute',
- left: 0,
- },
- });
-
-export type Props = WithStyles;
+ }),
+);
-function CustomizedProgress(props: Props) {
- const { classes } = props;
+function CustomizedProgress() {
+ const classes = useStyles();
return (
-
-
-
-
+
+
+
-
-
-
-
-
+
+
);
}
-CustomizedProgress.propTypes = {
- classes: PropTypes.object.isRequired,
-} as any;
-
-export default withStyles(styles)(CustomizedProgress);
+export default CustomizedProgress;
diff --git a/docs/src/pages/demos/selects/CustomizedSelects.js b/docs/src/pages/demos/selects/CustomizedSelects.js
index dafda903e494d2..b3db9a9e4c73b7 100644
--- a/docs/src/pages/demos/selects/CustomizedSelects.js
+++ b/docs/src/pages/demos/selects/CustomizedSelects.js
@@ -51,9 +51,6 @@ const useStyles = makeStyles(theme => ({
margin: {
margin: theme.spacing(1),
},
- bootstrapFormLabel: {
- fontSize: 18,
- },
}));
function CustomizedSelects() {
@@ -65,15 +62,11 @@ function CustomizedSelects() {
return (