Skip to content

Commit

Permalink
[docs] Fix typechecking (#15501)
Browse files Browse the repository at this point in the history
* [docs] Add alias

* Add @material-ui/lab

* Fix a few type errors

* Set alias in root

* docs:typescript:formatted

* Fix type-widening issues

* [docs] Remove buggy TS demos

* [system] Fix css typings


Co-authored-by: Sebastian Silbermann <[email protected]>
  • Loading branch information
merceyz and eps1lon committed May 2, 2019
1 parent e36d33a commit f108bfd
Show file tree
Hide file tree
Showing 20 changed files with 261 additions and 348 deletions.
49 changes: 0 additions & 49 deletions docs/src/pages/css-in-js/basics/AdaptingHook.tsx

This file was deleted.

58 changes: 30 additions & 28 deletions docs/src/pages/demos/autocomplete/IntegrationAutosuggest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import TextField from '@material-ui/core/TextField';
import Paper from '@material-ui/core/Paper';
import MenuItem from '@material-ui/core/MenuItem';
import Popper from '@material-ui/core/Popper';
import { makeStyles, Theme } from '@material-ui/core/styles';
import { createStyles, makeStyles, Theme } from '@material-ui/core/styles';

interface OptionType {
label: string;
Expand Down Expand Up @@ -113,33 +113,35 @@ function getSuggestionValue(suggestion: OptionType) {
return suggestion.label;
}

const useStyles = makeStyles((theme: Theme) => ({
root: {
height: 250,
flexGrow: 1,
},
container: {
position: 'relative',
},
suggestionsContainerOpen: {
position: 'absolute',
zIndex: 1,
marginTop: theme.spacing(1),
left: 0,
right: 0,
},
suggestion: {
display: 'block',
},
suggestionsList: {
margin: 0,
padding: 0,
listStyleType: 'none',
},
divider: {
height: theme.spacing(2),
},
}));
const useStyles = makeStyles((theme: Theme) =>
createStyles({
root: {
height: 250,
flexGrow: 1,
},
container: {
position: 'relative',
},
suggestionsContainerOpen: {
position: 'absolute',
zIndex: 1,
marginTop: theme.spacing(1),
left: 0,
right: 0,
},
suggestion: {
display: 'block',
},
suggestionsList: {
margin: 0,
padding: 0,
listStyleType: 'none',
},
divider: {
height: theme.spacing(2),
},
}),
);

function IntegrationAutosuggest() {
const classes = useStyles();
Expand Down
26 changes: 14 additions & 12 deletions docs/src/pages/demos/chips/ChipsArray.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { makeStyles, Theme } from '@material-ui/core/styles';
import { createStyles, makeStyles, Theme } from '@material-ui/core/styles';
import Chip from '@material-ui/core/Chip';
import Paper from '@material-ui/core/Paper';
import TagFacesIcon from '@material-ui/icons/TagFaces';
Expand All @@ -9,17 +9,19 @@ interface ChipData {
label: string;
}

const useStyles = makeStyles((theme: Theme) => ({
root: {
display: 'flex',
justifyContent: 'center',
flexWrap: 'wrap',
padding: theme.spacing(0.5),
},
chip: {
margin: theme.spacing(0.5),
},
}));
const useStyles = makeStyles((theme: Theme) =>
createStyles({
root: {
display: 'flex',
justifyContent: 'center',
flexWrap: 'wrap',
padding: theme.spacing(0.5),
},
chip: {
margin: theme.spacing(0.5),
},
}),
);

function ChipsArray() {
const classes = useStyles();
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/demos/dialogs/ConfirmationDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const options = [
];

export interface ConfirmationDialogRawProps {
classes: Record<'paper', 'string'>;
classes: Record<'paper', string>;
value: string;
open: boolean;
onClose: (value: string) => void;
Expand Down
22 changes: 12 additions & 10 deletions docs/src/pages/demos/dialogs/FullScreenDialog.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { makeStyles, Theme } from '@material-ui/core/styles';
import { createStyles, makeStyles, Theme } from '@material-ui/core/styles';
import Button from '@material-ui/core/Button';
import Dialog from '@material-ui/core/Dialog';
import ListItemText from '@material-ui/core/ListItemText';
Expand All @@ -14,15 +14,17 @@ import CloseIcon from '@material-ui/icons/Close';
import Slide from '@material-ui/core/Slide';
import { TransitionProps } from '@material-ui/core/transitions';

const useStyles = makeStyles((theme: Theme) => ({
appBar: {
position: 'relative',
},
title: {
marginLeft: theme.spacing(2),
flex: 1,
},
}));
const useStyles = makeStyles((theme: Theme) =>
createStyles({
appBar: {
position: 'relative',
},
title: {
marginLeft: theme.spacing(2),
flex: 1,
},
}),
);

const Transition = React.forwardRef<unknown, TransitionProps>(function Transition(props, ref) {
return <Slide direction="up" ref={ref} {...props} />;
Expand Down
122 changes: 62 additions & 60 deletions docs/src/pages/demos/drawers/MiniDrawer.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import clsx from 'clsx';
import { makeStyles, useTheme, Theme } from '@material-ui/core/styles';
import { createStyles, makeStyles, useTheme, Theme } from '@material-ui/core/styles';
import Drawer from '@material-ui/core/Drawer';
import AppBar from '@material-ui/core/AppBar';
import Toolbar from '@material-ui/core/Toolbar';
Expand All @@ -20,66 +20,68 @@ import MailIcon from '@material-ui/icons/Mail';

const drawerWidth = 240;

const useStyles = makeStyles((theme: Theme) => ({
root: {
display: 'flex',
},
appBar: {
zIndex: theme.zIndex.drawer + 1,
transition: theme.transitions.create(['width', 'margin'], {
easing: theme.transitions.easing.sharp,
duration: theme.transitions.duration.leavingScreen,
}),
},
appBarShift: {
marginLeft: drawerWidth,
width: `calc(100% - ${drawerWidth}px)`,
transition: theme.transitions.create(['width', 'margin'], {
easing: theme.transitions.easing.sharp,
duration: theme.transitions.duration.enteringScreen,
}),
},
menuButton: {
marginRight: 36,
},
hide: {
display: 'none',
},
drawer: {
width: drawerWidth,
flexShrink: 0,
whiteSpace: 'nowrap',
},
drawerOpen: {
width: drawerWidth,
transition: theme.transitions.create('width', {
easing: theme.transitions.easing.sharp,
duration: theme.transitions.duration.enteringScreen,
}),
},
drawerClose: {
transition: theme.transitions.create('width', {
easing: theme.transitions.easing.sharp,
duration: theme.transitions.duration.leavingScreen,
}),
overflowX: 'hidden',
width: theme.spacing(7) + 1,
[theme.breakpoints.up('sm')]: {
width: theme.spacing(9) + 1,
const useStyles = makeStyles((theme: Theme) =>
createStyles({
root: {
display: 'flex',
},
},
toolbar: {
display: 'flex',
alignItems: 'center',
justifyContent: 'flex-end',
padding: '0 8px',
...theme.mixins.toolbar,
},
content: {
flexGrow: 1,
padding: theme.spacing(3),
},
}));
appBar: {
zIndex: theme.zIndex.drawer + 1,
transition: theme.transitions.create(['width', 'margin'], {
easing: theme.transitions.easing.sharp,
duration: theme.transitions.duration.leavingScreen,
}),
},
appBarShift: {
marginLeft: drawerWidth,
width: `calc(100% - ${drawerWidth}px)`,
transition: theme.transitions.create(['width', 'margin'], {
easing: theme.transitions.easing.sharp,
duration: theme.transitions.duration.enteringScreen,
}),
},
menuButton: {
marginRight: 36,
},
hide: {
display: 'none',
},
drawer: {
width: drawerWidth,
flexShrink: 0,
whiteSpace: 'nowrap',
},
drawerOpen: {
width: drawerWidth,
transition: theme.transitions.create('width', {
easing: theme.transitions.easing.sharp,
duration: theme.transitions.duration.enteringScreen,
}),
},
drawerClose: {
transition: theme.transitions.create('width', {
easing: theme.transitions.easing.sharp,
duration: theme.transitions.duration.leavingScreen,
}),
overflowX: 'hidden',
width: theme.spacing(7) + 1,
[theme.breakpoints.up('sm')]: {
width: theme.spacing(9) + 1,
},
},
toolbar: {
display: 'flex',
alignItems: 'center',
justifyContent: 'flex-end',
padding: '0 8px',
...theme.mixins.toolbar,
},
content: {
flexGrow: 1,
padding: theme.spacing(3),
},
}),
);

function MiniDrawer() {
const classes = useStyles();
Expand Down
Loading

0 comments on commit f108bfd

Please sign in to comment.