Skip to content
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

[docs] Miscellaneous polish #15665

Merged
merged 8 commits into from May 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions docs/src/pages/components/.eslintrc.js
@@ -0,0 +1,8 @@
module.exports = {
rules: {
// useful for interactions feedback
'no-alert': 'off',
// not very friendly to props forwarding
'react/jsx-handler-names': 'off',
},
};
4 changes: 1 addition & 3 deletions docs/src/pages/components/app-bar/ElevateAppBar.js
@@ -1,5 +1,3 @@
/* eslint-disable prefer-spread */

import React from 'react';
import PropTypes from 'prop-types';
import AppBar from '@material-ui/core/AppBar';
Expand Down Expand Up @@ -47,7 +45,7 @@ export default function ElevateAppBar(props) {
<Toolbar />
<Container>
<Box my={2}>
{Array.apply(null, Array(12))
{[...new Array(12)]
.map(
() => `Cras mattis consectetur purus sit amet fermentum.
Cras justo odio, dapibus ac facilisis in, egestas eget quam.
Expand Down
4 changes: 1 addition & 3 deletions docs/src/pages/components/app-bar/ElevateAppBar.tsx
@@ -1,5 +1,3 @@
/* eslint-disable prefer-spread */

import React from 'react';
import PropTypes from 'prop-types';
import AppBar from '@material-ui/core/AppBar';
Expand Down Expand Up @@ -52,7 +50,7 @@ export default function ElevateAppBar(props: Props) {
<Toolbar />
<Container>
<Box my={2}>
{Array.apply(null, Array(12))
{[...new Array(12)]
.map(
() => `Cras mattis consectetur purus sit amet fermentum.
Cras justo odio, dapibus ac facilisis in, egestas eget quam.
Expand Down
4 changes: 1 addition & 3 deletions docs/src/pages/components/app-bar/HideAppBar.js
@@ -1,5 +1,3 @@
/* eslint-disable prefer-spread */

import React from 'react';
import PropTypes from 'prop-types';
import AppBar from '@material-ui/core/AppBar';
Expand Down Expand Up @@ -46,7 +44,7 @@ export default function HideAppBar(props) {
<Toolbar />
<Container>
<Box my={2}>
{Array.apply(null, Array(12))
{[...new Array(12)]
.map(
() => `Cras mattis consectetur purus sit amet fermentum.
Cras justo odio, dapibus ac facilisis in, egestas eget quam.
Expand Down
4 changes: 1 addition & 3 deletions docs/src/pages/components/app-bar/HideAppBar.tsx
@@ -1,5 +1,3 @@
/* eslint-disable prefer-spread */

import React from 'react';
import PropTypes from 'prop-types';
import AppBar from '@material-ui/core/AppBar';
Expand Down Expand Up @@ -51,7 +49,7 @@ export default function HideAppBar(props: Props) {
<Toolbar />
<Container>
<Box my={2}>
{Array.apply(null, Array(12))
{[...new Array(12)]
.map(
() => `Cras mattis consectetur purus sit amet fermentum.
Cras justo odio, dapibus ac facilisis in, egestas eget quam.
Expand Down
58 changes: 56 additions & 2 deletions docs/src/pages/components/autocomplete/IntegrationReactSelect.js
@@ -1,5 +1,3 @@
/* eslint-disable react/prop-types, react/jsx-handler-names */

import React from 'react';
import clsx from 'clsx';
import Select from 'react-select';
Expand All @@ -12,6 +10,7 @@ import Chip from '@material-ui/core/Chip';
import MenuItem from '@material-ui/core/MenuItem';
import CancelIcon from '@material-ui/icons/Cancel';
import { emphasize } from '@material-ui/core/styles/colorManipulator';
import PropTypes from 'prop-types';

const suggestions = [
{ label: 'Afghanistan' },
Expand Down Expand Up @@ -115,10 +114,20 @@ function NoOptionsMessage(props) {
);
}

NoOptionsMessage.propTypes = {
children: PropTypes.node,
innerProps: PropTypes.object,
selectProps: PropTypes.object.isRequired,
};

function inputComponent({ inputRef, ...props }) {
return <div ref={inputRef} {...props} />;
}

inputComponent.propTypes = {
inputRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
};

function Control(props) {
return (
<TextField
Expand All @@ -137,6 +146,13 @@ function Control(props) {
);
}

Control.propTypes = {
children: PropTypes.node,
innerProps: PropTypes.object,
innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
selectProps: PropTypes.object.isRequired,
};

function Option(props) {
return (
<MenuItem
Expand All @@ -153,6 +169,14 @@ function Option(props) {
);
}

Option.propTypes = {
children: PropTypes.node,
innerProps: PropTypes.object,
innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
isFocused: PropTypes.bool,
isSelected: PropTypes.bool,
};

function Placeholder(props) {
return (
<Typography
Expand All @@ -165,6 +189,12 @@ function Placeholder(props) {
);
}

Placeholder.propTypes = {
children: PropTypes.node,
innerProps: PropTypes.object,
selectProps: PropTypes.object.isRequired,
};

function SingleValue(props) {
return (
<Typography className={props.selectProps.classes.singleValue} {...props.innerProps}>
Expand All @@ -173,10 +203,21 @@ function SingleValue(props) {
);
}

SingleValue.propTypes = {
children: PropTypes.node,
innerProps: PropTypes.object,
selectProps: PropTypes.object.isRequired,
};

function ValueContainer(props) {
return <div className={props.selectProps.classes.valueContainer}>{props.children}</div>;
}

ValueContainer.propTypes = {
children: PropTypes.node,
selectProps: PropTypes.object.isRequired,
};

function MultiValue(props) {
return (
<Chip
Expand All @@ -191,6 +232,13 @@ function MultiValue(props) {
);
}

MultiValue.propTypes = {
children: PropTypes.node,
isFocused: PropTypes.bool,
removeProps: PropTypes.object.isRequired,
selectProps: PropTypes.object.isRequired,
};

function Menu(props) {
return (
<Paper square className={props.selectProps.classes.paper} {...props.innerProps}>
Expand All @@ -199,6 +247,12 @@ function Menu(props) {
);
}

Menu.propTypes = {
children: PropTypes.node,
innerProps: PropTypes.object,
selectProps: PropTypes.object,
};

const components = {
Control,
Menu,
Expand Down
58 changes: 56 additions & 2 deletions docs/src/pages/components/autocomplete/IntegrationReactSelect.tsx
@@ -1,5 +1,3 @@
/* eslint-disable react/prop-types, react/jsx-handler-names */

import React, { CSSProperties, HTMLAttributes } from 'react';
import clsx from 'clsx';
import Select from 'react-select';
Expand All @@ -12,6 +10,7 @@ import Chip from '@material-ui/core/Chip';
import MenuItem from '@material-ui/core/MenuItem';
import CancelIcon from '@material-ui/icons/Cancel';
import { emphasize } from '@material-ui/core/styles/colorManipulator';
import PropTypes from 'prop-types';
import { ValueContainerProps } from 'react-select/lib/components/containers';
import { ControlProps } from 'react-select/lib/components/Control';
import { MenuProps, NoticeProps } from 'react-select/lib/components/Menu';
Expand Down Expand Up @@ -130,12 +129,22 @@ function NoOptionsMessage(props: NoticeProps<OptionType>) {
);
}

NoOptionsMessage.propTypes = {
children: PropTypes.node,
innerProps: PropTypes.object,
selectProps: PropTypes.object.isRequired,
} as any;

type InputComponentProps = Pick<BaseTextFieldProps, 'inputRef'> & HTMLAttributes<HTMLDivElement>;

function inputComponent({ inputRef, ...props }: InputComponentProps) {
return <div ref={inputRef} {...props} />;
}

inputComponent.propTypes = {
inputRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
} as any;

function Control(props: ControlProps<OptionType>) {
return (
<TextField
Expand All @@ -154,6 +163,13 @@ function Control(props: ControlProps<OptionType>) {
);
}

Control.propTypes = {
children: PropTypes.node,
innerProps: PropTypes.object,
innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
selectProps: PropTypes.object.isRequired,
} as any;

function Option(props: OptionProps<OptionType>) {
return (
<MenuItem
Expand All @@ -170,6 +186,14 @@ function Option(props: OptionProps<OptionType>) {
);
}

Option.propTypes = {
children: PropTypes.node,
innerProps: PropTypes.object,
innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
isFocused: PropTypes.bool,
isSelected: PropTypes.bool,
} as any;

function Placeholder(props: PlaceholderProps<OptionType>) {
return (
<Typography
Expand All @@ -182,6 +206,12 @@ function Placeholder(props: PlaceholderProps<OptionType>) {
);
}

Placeholder.propTypes = {
children: PropTypes.node,
innerProps: PropTypes.object,
selectProps: PropTypes.object.isRequired,
} as any;

function SingleValue(props: SingleValueProps<OptionType>) {
return (
<Typography className={props.selectProps.classes.singleValue} {...props.innerProps}>
Expand All @@ -190,10 +220,21 @@ function SingleValue(props: SingleValueProps<OptionType>) {
);
}

SingleValue.propTypes = {
children: PropTypes.node,
innerProps: PropTypes.object,
selectProps: PropTypes.object.isRequired,
} as any;

function ValueContainer(props: ValueContainerProps<OptionType>) {
return <div className={props.selectProps.classes.valueContainer}>{props.children}</div>;
}

ValueContainer.propTypes = {
children: PropTypes.node,
selectProps: PropTypes.object.isRequired,
} as any;

function MultiValue(props: MultiValueProps<OptionType>) {
return (
<Chip
Expand All @@ -208,6 +249,13 @@ function MultiValue(props: MultiValueProps<OptionType>) {
);
}

MultiValue.propTypes = {
children: PropTypes.node,
isFocused: PropTypes.bool,
removeProps: PropTypes.object.isRequired,
selectProps: PropTypes.object.isRequired,
} as any;

function Menu(props: MenuProps<OptionType>) {
return (
<Paper square className={props.selectProps.classes.paper} {...props.innerProps}>
Expand All @@ -216,6 +264,12 @@ function Menu(props: MenuProps<OptionType>) {
);
}

Menu.propTypes = {
children: PropTypes.node,
innerProps: PropTypes.object,
selectProps: PropTypes.object,
} as any;

const components = {
Control,
Menu,
Expand Down
Expand Up @@ -19,7 +19,7 @@ const useStyles = makeStyles(theme => ({

function handleClick(event) {
event.preventDefault();
alert('You clicked a breadcrumb.'); // eslint-disable-line no-alert
alert('You clicked a breadcrumb.');
}

function CollapsedBreadcrumbs() {
Expand Down
Expand Up @@ -21,7 +21,7 @@ const useStyles = makeStyles((theme: Theme) =>

function handleClick(event: React.MouseEvent<HTMLAnchorElement, MouseEvent>) {
event.preventDefault();
alert('You clicked a breadcrumb.'); // eslint-disable-line no-alert
alert('You clicked a breadcrumb.');
}

function CollapsedBreadcrumbs() {
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/components/breadcrumbs/CustomSeparator.js
Expand Up @@ -18,7 +18,7 @@ const useStyles = makeStyles(theme => ({

function handleClick(event) {
event.preventDefault();
alert('You clicked a breadcrumb.'); // eslint-disable-line no-alert
alert('You clicked a breadcrumb.');
}

function CustomSeparator() {
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/components/breadcrumbs/CustomSeparator.tsx
Expand Up @@ -20,7 +20,7 @@ const useStyles = makeStyles((theme: Theme) =>

function handleClick(event: React.MouseEvent<HTMLAnchorElement, MouseEvent>) {
event.preventDefault();
alert('You clicked a breadcrumb.'); // eslint-disable-line no-alert
alert('You clicked a breadcrumb.');
}

function CustomSeparator() {
Expand Down
Expand Up @@ -26,7 +26,7 @@ const StyledBreadcrumb = withStyles(theme => ({

function handleClick(event) {
event.preventDefault();
alert('You clicked a breadcrumb.'); // eslint-disable-line no-alert
alert('You clicked a breadcrumb.');
}

const useStyles = makeStyles(theme => ({
Expand Down
Expand Up @@ -26,7 +26,7 @@ const StyledBreadcrumb = withStyles((theme: Theme) => ({

function handleClick(event: React.MouseEvent<Element, MouseEvent>) {
event.preventDefault();
alert('You clicked a breadcrumb.'); // eslint-disable-line no-alert
alert('You clicked a breadcrumb.');
}

const useStyles = makeStyles((theme: Theme) =>
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/components/breadcrumbs/IconBreadcrumbs.js
Expand Up @@ -24,7 +24,7 @@ const useStyles = makeStyles(theme => ({

function handleClick(event) {
event.preventDefault();
alert('You clicked a breadcrumb.'); // eslint-disable-line no-alert
alert('You clicked a breadcrumb.');
}

function IconBreadcrumbs() {
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/components/breadcrumbs/IconBreadcrumbs.tsx
Expand Up @@ -26,7 +26,7 @@ const useStyles = makeStyles((theme: Theme) =>

function handleClick(event: React.MouseEvent<HTMLAnchorElement, MouseEvent>) {
event.preventDefault();
alert('You clicked a breadcrumb.'); // eslint-disable-line no-alert
alert('You clicked a breadcrumb.');
}

function IconBreadcrumbs() {
Expand Down