diff --git a/.size-limit.js b/.size-limit.js index 4328b586eca5ec..15d90e418b7b34 100644 --- a/.size-limit.js +++ b/.size-limit.js @@ -22,7 +22,7 @@ module.exports = [ name: 'The size of the @material-ui/core modules', webpack: true, path: 'packages/material-ui/build/index.js', - limit: '95.7 KB', + limit: '96 KB', }, { name: 'The size of the @material-ui/styles modules', @@ -61,7 +61,7 @@ module.exports = [ name: 'The main docs bundle', webpack: false, path: main.path, - limit: '182 KB', + limit: '183 KB', }, { name: 'The docs home page', diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index cd3822c2a52b89..27fd8c3190c758 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -10,7 +10,7 @@ When in doubt, keep your pull requests small. To give a PR the best chance of ge As with issues, please begin the title with [ComponentName]. -When adding new features or modifying existing, please attempt to include tests to confirm the new behaviour. You can read more about our test setup [here](https://github.com/mui-org/material-ui/blob/master/test/README.md). +When adding new features or modifying existing, please attempt to include tests to confirm the new behaviour. You can read more about our test setup in our test [README](https://github.com/mui-org/material-ui/blob/master/test/README.md). When migrating a component to master, or submitting a new component, please add it to the [lab](https://github.com/mui-org/material-ui/tree/master/packages/material-ui-lab). diff --git a/docs/src/modules/components/AppDrawer.js b/docs/src/modules/components/AppDrawer.js index f01bc0635e8c03..2fc1b41d73ec69 100644 --- a/docs/src/modules/components/AppDrawer.js +++ b/docs/src/modules/components/AppDrawer.js @@ -6,7 +6,6 @@ import { withStyles } from '@material-ui/core/styles'; import List from '@material-ui/core/List'; import Drawer from '@material-ui/core/Drawer'; import SwipeableDrawer from '@material-ui/core/SwipeableDrawer'; -import Typography from '@material-ui/core/Typography'; import Divider from '@material-ui/core/Divider'; import Hidden from '@material-ui/core/Hidden'; import AppDrawerNavItem from 'docs/src/modules/components/AppDrawerNavItem'; @@ -38,9 +37,6 @@ const styles = theme => ({ alignItems: 'flex-start', justifyContent: 'center', }, - anchor: { - color: theme.palette.text.secondary, - }, }); // eslint-disable-next-line react/prop-types @@ -102,14 +98,22 @@ function AppDrawer(props) {
- - - Material-UI - + + Material-UI {process.env.LIB_VERSION ? ( - - {`v${process.env.LIB_VERSION}`} + + {`v${process.env.LIB_VERSION}`} ) : null}
diff --git a/docs/src/modules/components/AppDrawerNavItem.js b/docs/src/modules/components/AppDrawerNavItem.js index 074acc224ebb92..f3acbcada17ced 100644 --- a/docs/src/modules/components/AppDrawerNavItem.js +++ b/docs/src/modules/components/AppDrawerNavItem.js @@ -83,7 +83,7 @@ class AppDrawerNavItem extends React.Component {
diff --git a/docs/src/modules/components/Link.js b/docs/src/modules/components/Link.js index cf89e07dc69c69..50aba7e70edb6b 100644 --- a/docs/src/modules/components/Link.js +++ b/docs/src/modules/components/Link.js @@ -1,118 +1,63 @@ -/* eslint-disable jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions */ +/* eslint-disable jsx-a11y/click-events-have-key-events */ +/* eslint-disable jsx-a11y/no-static-element-interactions */ +/* eslint-disable jsx-a11y/anchor-has-content */ import React from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; -import compose from 'recompose/compose'; import { withRouter } from 'next/router'; import NextLink from 'next/link'; -import { withStyles } from '@material-ui/core/styles'; +import MuiLink from '@material-ui/core/Link'; -const styles = theme => ({ - root: { - textDecoration: 'none', - '&:hover': { - textDecoration: 'underline', - }, - }, - default: { - color: 'inherit', - }, - primary: { - color: theme.palette.primary.main, - }, - secondary: { - color: theme.palette.secondary.main, - }, - button: { - '&:hover': { - textDecoration: 'inherit', - }, - }, -}); +function NextWrapper(props) { + const { className, activeClassName, onClick, router, href, prefetch, ...other } = props; -function Link(props) { - const { - activeClassName, - children: childrenProp, - classes, - className: classNameProp, - component: ComponentProp, - href, - onClick, - prefetch, - router, - variant, - ...other - } = props; - - let ComponentRoot; - const className = classNames( - classes.root, - { - [classes[variant]]: variant !== 'inherit', - }, - classNameProp, - ); - let RootProps; - let children = childrenProp; - - if (ComponentProp) { - ComponentRoot = ComponentProp; - RootProps = { - ...other, - className, - }; - } else if (href) { - ComponentRoot = NextLink; - RootProps = { - href, - prefetch, - passHref: true, - }; - children = ( + return ( + - {children} - - ); - } else { - ComponentRoot = 'a'; - RootProps = { - ...other, - className, - }; - } - - return {children}; + /> + + ); } -Link.defaultProps = { - variant: 'default', +NextWrapper.defaultProps = { activeClassName: 'active', }; -Link.propTypes = { +NextWrapper.propTypes = { activeClassName: PropTypes.string, - children: PropTypes.node.isRequired, - classes: PropTypes.object.isRequired, - className: PropTypes.string, - component: PropTypes.any, href: PropTypes.string, onClick: PropTypes.func, prefetch: PropTypes.bool, router: PropTypes.shape({ pathname: PropTypes.string.isRequired, }).isRequired, - variant: PropTypes.oneOf(['default', 'primary', 'secondary', 'button', 'inherit']), }; -export default compose( - withRouter, - withStyles(styles), -)(Link); +function Link(props) { + const { naked, ...other } = props; + + const ToRender = { + component: NextWrapper, + ...other, + }; + + if (naked) { + const { component: Component, ...rest } = ToRender; + + return ; + } + + return ; +} + +Link.propTypes = { + naked: PropTypes.bool, +}; + +export default withRouter(Link); diff --git a/docs/src/modules/components/Tidelift.js b/docs/src/modules/components/Tidelift.js index ca3bc6ae2cc2e0..a9973c8d49b65e 100644 --- a/docs/src/modules/components/Tidelift.js +++ b/docs/src/modules/components/Tidelift.js @@ -11,6 +11,7 @@ const styles = theme => ({ right: 0, left: 0, display: 'flex', + color: theme.palette.common.white, backgroundColor: '#626980', // Tidelift color. position: 'relative', top: 56, @@ -24,14 +25,11 @@ const styles = theme => ({ }, logo: { background: 'url(/static/images/tidelift.svg) no-repeat 50%', - content: "''", + content: '""', width: 20, height: 20, margin: `0 ${theme.spacing.unit}px 0 0`, }, - label: { - color: theme.palette.common.white, - }, }); function Tidelift(props) { @@ -40,13 +38,12 @@ function Tidelift(props) { return ( - Get Professionally Supported Material-UI + Get Professionally Supported Material-UI ); } diff --git a/docs/src/pages/css-in-js/advanced/advanced.md b/docs/src/pages/css-in-js/advanced/advanced.md index 10371e3fc883e7..b975988ee26b0d 100644 --- a/docs/src/pages/css-in-js/advanced/advanced.md +++ b/docs/src/pages/css-in-js/advanced/advanced.md @@ -292,7 +292,7 @@ Basically, CSP mitigates cross-site scripting (XSS) attacks by requiring develop This vulnerability would allow the attacker to execute anything. However, with a secure CSP header, the browser will not load this script. -You can read more about CSP [here](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP). +You can read more about CSP on the [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP). ### How does one implement CSP? diff --git a/docs/src/pages/demos/buttons/buttons.md b/docs/src/pages/demos/buttons/buttons.md index 3deefd45ad8c65..35a3cf31fb20f9 100644 --- a/docs/src/pages/demos/buttons/buttons.md +++ b/docs/src/pages/demos/buttons/buttons.md @@ -142,4 +142,4 @@ const MyLink = props => ``` -*Note: Creating `MyLink` is necessary to prevent unexpected unmounting. You can read more about it [here](/guides/composition/#component-property).* +*Note: Creating `MyLink` is necessary to prevent unexpected unmounting. You can read more about it in our [composition guide](/guides/composition/#component-property).* diff --git a/docs/src/pages/discover-more/showcase/Showcase.js b/docs/src/pages/discover-more/showcase/Showcase.js index 962aa290034234..c8e5e08fdaf8fb 100644 --- a/docs/src/pages/discover-more/showcase/Showcase.js +++ b/docs/src/pages/discover-more/showcase/Showcase.js @@ -5,7 +5,6 @@ import Card from '@material-ui/core/Card'; import CardMedia from '@material-ui/core/CardMedia'; import Typography from '@material-ui/core/Typography'; import IconButton from '@material-ui/core/IconButton'; -import Link from 'docs/src/modules/components/Link'; import GithubIcon from '@material-ui/docs/svgIcons/GitHub'; const styles = theme => ({ @@ -646,9 +645,15 @@ function Showcase(props) { ) : null} - - - + {app.description}
diff --git a/docs/src/pages/getting-started/page-layout-examples/album/README.md b/docs/src/pages/getting-started/page-layout-examples/album/README.md index c22c7348a6b03c..4f1804334af533 100644 --- a/docs/src/pages/getting-started/page-layout-examples/album/README.md +++ b/docs/src/pages/getting-started/page-layout-examples/album/README.md @@ -4,7 +4,7 @@ Simply copy the files into your project, or one of the [example applications](https://github.com/mui-org/material-ui/tree/master/examples), and import and use the `Album` component. -You can customise the layout to add some pizazz in keeping with your corporate theme. +You can customize the layout to add some pizazz in keeping with your corporate theme. ## Files diff --git a/docs/src/pages/getting-started/page-layout-examples/blog/README.md b/docs/src/pages/getting-started/page-layout-examples/blog/README.md index bdf2743e7423ed..062b56fc644621 100644 --- a/docs/src/pages/getting-started/page-layout-examples/blog/README.md +++ b/docs/src/pages/getting-started/page-layout-examples/blog/README.md @@ -4,14 +4,14 @@ Simply copy the files into your project, or one of the [example applications](https://github.com/mui-org/material-ui/tree/master/examples), and import and use the `Dashboard` component. -You can easily customise the layout to suit your design, and substitute an alternative markdown renderer. +You can easily customize the layout to suit your design, and substitute an alternative markdown renderer. ## Files | File | Purpose | |--- |--- | -| `Blog.js` | Main file. Customise the layout by adding grid components and changing breakpoints. | -| `Markdown.js` | Markdown renderer. It enhances markdown-to-jsx output to use the Typography |component. You can customise it or substitute an alternative. +| `Blog.js` | Main file. Customize the layout by adding grid components and changing breakpoints. | +| `Markdown.js` | Markdown renderer. It enhances markdown-to-jsx output to use the Typography |component. You can customize it or substitute an alternative. | `blog-post.x.md` | Sample blog posts to demonstrate the renderer.| ## Dependencies diff --git a/docs/src/pages/getting-started/page-layout-examples/checkout/README.md b/docs/src/pages/getting-started/page-layout-examples/checkout/README.md index 29795495f15f6e..9da1b52d263846 100644 --- a/docs/src/pages/getting-started/page-layout-examples/checkout/README.md +++ b/docs/src/pages/getting-started/page-layout-examples/checkout/README.md @@ -4,7 +4,7 @@ Simply copy the files into your project, or one of the [example applications](https://github.com/mui-org/material-ui/tree/master/examples), and import and use the `Checkout` component. -You can customise the Stepper logic and steps to suit your specific checkout workflow and data requirements. +You can customize the Stepper logic and steps to suit your specific checkout workflow and data requirements. ## Files diff --git a/docs/src/pages/getting-started/page-layout-examples/dashboard/README.md b/docs/src/pages/getting-started/page-layout-examples/dashboard/README.md index 57cbfe51a3a16a..2abea4b6b8d79f 100644 --- a/docs/src/pages/getting-started/page-layout-examples/dashboard/README.md +++ b/docs/src/pages/getting-started/page-layout-examples/dashboard/README.md @@ -4,16 +4,16 @@ Simply copy the files into your project, or one of the [example applications](https://github.com/mui-org/material-ui/tree/master/examples), and import and use the `Dashboard` component. -You can customise the sections, layout and charts to suit your specific business requirements. +You can customize the sections, layout and charts to suit your specific business requirements. ## Files | File | Purpose | |--- |--- | -| `Dashboard.js` | Main file. Customise the layout by adding grid components and changing breakpoints. | +| `Dashboard.js` | Main file. Customize the layout by adding grid components and changing breakpoints. | | `listItems.js` | The list items for the Drawer. | | `SimpleLineChart.js` | The main chart component. Use as a basis for additional charts. | -| `SimpleTable.js` | Use as is, customise, or replace with some other functionality. | +| `SimpleTable.js` | Use as is, customize, or replace with some other functionality. | ## Dependencies diff --git a/docs/src/pages/getting-started/page-layout-examples/pricing/README.md b/docs/src/pages/getting-started/page-layout-examples/pricing/README.md index c2f6a60fdcf0de..deb121083d6586 100644 --- a/docs/src/pages/getting-started/page-layout-examples/pricing/README.md +++ b/docs/src/pages/getting-started/page-layout-examples/pricing/README.md @@ -4,7 +4,7 @@ Simply copy the files into your project, or one of the [example applications](https://github.com/mui-org/material-ui/tree/master/examples), and import and use the `Pricing` component. -You can customise the layout to add some pizazz in keeping with your corporate theme. +You can customize the layout to add some pizazz in keeping with your corporate theme. ## Files diff --git a/docs/src/pages/getting-started/page-layout-examples/sign-in/README.md b/docs/src/pages/getting-started/page-layout-examples/sign-in/README.md index b3f80f0d450acf..d97104a5dc11b6 100644 --- a/docs/src/pages/getting-started/page-layout-examples/sign-in/README.md +++ b/docs/src/pages/getting-started/page-layout-examples/sign-in/README.md @@ -4,13 +4,13 @@ Simply copy the files into your project, or one of the [example applications](https://github.com/mui-org/material-ui/tree/master/examples), and import and use the `SignIn` component. -You can customise the layout to add some pizazz in keeping with your corporate theme. +You can customize the layout to add some pizazz in keeping with your corporate theme. ## Files | File | Purpose | |--- |--- | -| `SignIn.js` | A simple sign-in layout in a single file. Duplicate and customise it to make your registration and password change forms. | +| `SignIn.js` | A simple sign-in layout in a single file. Duplicate and customize it to make your registration and password change forms. | ## Dependencies diff --git a/docs/src/pages/layout/breakpoints/breakpoints.md b/docs/src/pages/layout/breakpoints/breakpoints.md index 10bd02b346e07b..03e18823ad94e6 100644 --- a/docs/src/pages/layout/breakpoints/breakpoints.md +++ b/docs/src/pages/layout/breakpoints/breakpoints.md @@ -58,7 +58,7 @@ You might want to change the React rendering tree based on the breakpoint value, ### useMediaQuery hook -You can learn more about this hook [here](/layout/use-media-query/). +You can learn more on the [useMediaQuery](/layout/use-media-query/) page. ### withWidth() diff --git a/docs/src/pages/premium-themes/PremiumThemes.js b/docs/src/pages/premium-themes/PremiumThemes.js index 8a81f38f59a550..b51eb50fe2e41c 100644 --- a/docs/src/pages/premium-themes/PremiumThemes.js +++ b/docs/src/pages/premium-themes/PremiumThemes.js @@ -111,6 +111,7 @@ function PremiumThemes(props) { component="a" href={theme.href} rel="noopener nofollow" + target="_blank" className={classes.media} image={theme.src} title={theme.name} diff --git a/docs/src/pages/premium-themes/onepirate/SignIn.js b/docs/src/pages/premium-themes/onepirate/SignIn.js index fc385cf1d21c12..bbf1ff33c134e0 100644 --- a/docs/src/pages/premium-themes/onepirate/SignIn.js +++ b/docs/src/pages/premium-themes/onepirate/SignIn.js @@ -4,11 +4,11 @@ import React from 'react'; import PropTypes from 'prop-types'; import compose from 'recompose/compose'; import { withStyles } from '@material-ui/core/styles'; +import Link from '@material-ui/core/Link'; import { Field, Form, FormSpy } from 'react-final-form'; import Typography from './modules/components/Typography'; import AppFooter from './modules/views/AppFooter'; import AppAppBar from './modules/views/AppAppBar'; -import Link from './modules/next/Link'; import AppForm from './modules/views/AppForm'; import { email, required } from './modules/form/validation'; import RFTextField from './modules/form/RFTextField'; @@ -62,7 +62,7 @@ class SignIn extends React.Component { {'Not a member yet? '} - + Sign Up here @@ -119,17 +119,10 @@ class SignIn extends React.Component { )} - ( - - )} - align="center" - > - Forgot password? + + + Forgot password? + diff --git a/docs/src/pages/premium-themes/onepirate/SignUp.js b/docs/src/pages/premium-themes/onepirate/SignUp.js index 7edc3d07e4119a..227cec676e8a5a 100644 --- a/docs/src/pages/premium-themes/onepirate/SignUp.js +++ b/docs/src/pages/premium-themes/onepirate/SignUp.js @@ -5,11 +5,11 @@ import PropTypes from 'prop-types'; import compose from 'recompose/compose'; import { withStyles } from '@material-ui/core/styles'; import Grid from '@material-ui/core/Grid'; +import Link from '@material-ui/core/Link'; import { Field, Form, FormSpy } from 'react-final-form'; import Typography from './modules/components/Typography'; import AppFooter from './modules/views/AppFooter'; import AppAppBar from './modules/views/AppAppBar'; -import Link from './modules/next/Link'; import AppForm from './modules/views/AppForm'; import { email, required } from './modules/form/validation'; import RFTextField from './modules/form/RFTextField'; @@ -62,7 +62,7 @@ class SignUp extends React.Component { Sign Up - + Already have an account? diff --git a/docs/src/pages/premium-themes/onepirate/modules/next/Link.js b/docs/src/pages/premium-themes/onepirate/modules/next/Link.js deleted file mode 100644 index d830149b290741..00000000000000 --- a/docs/src/pages/premium-themes/onepirate/modules/next/Link.js +++ /dev/null @@ -1,115 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; -import classNames from 'classnames'; -import compose from 'recompose/compose'; -import NextLink from 'next/link'; -import { withRouter } from 'next/router'; -import { withStyles } from '@material-ui/core/styles'; - -const styles = theme => ({ - root: { - textDecoration: 'inherit', - '&:hover': { - textDecoration: 'underline', - }, - }, - default: { - color: 'inherit', - }, - underline: { - color: 'inherit', - textDecoration: 'underline', - }, - primary: { - color: theme.palette.primary.main, - }, - secondary: { - color: theme.palette.secondary.main, - }, - button: { - '&:hover': { - textDecoration: 'inherit', - }, - }, - active: {}, -}); - -function Link(props) { - const { - children: childrenProp, - classes, - className: classNameProp, - component: ComponentProp, - href, - params, - prefetch, - router, - variant, - ...other - } = props; - - let Component; - const className = classNames( - classes.root, - { - [classes[variant]]: variant !== 'inherit', - }, - classNameProp, - ); - let more; - let children = childrenProp; - - if (ComponentProp) { - Component = ComponentProp; - more = { - className, - ...other, - }; - } else if (href) { - Component = NextLink; - more = { - href, - ...params, - prefetch, - }; - children = ( - - {children} - - ); - } else { - Component = 'a'; - more = { - ...other, - className, - }; - } - - return {children}; -} - -Link.propTypes = { - children: PropTypes.node.isRequired, - classes: PropTypes.object.isRequired, - className: PropTypes.string, - component: PropTypes.oneOfType([PropTypes.string, PropTypes.func]), - href: PropTypes.string, - params: PropTypes.object, - prefetch: PropTypes.bool, - router: PropTypes.object.isRequired, - variant: PropTypes.oneOf(['default', 'underline', 'primary', 'secondary', 'button', 'inherit']), -}; - -Link.defaultProps = { - variant: 'primary', -}; - -export default compose( - withStyles(styles), - withRouter, -)(Link); diff --git a/docs/src/pages/premium-themes/onepirate/modules/views/AppAppBar.js b/docs/src/pages/premium-themes/onepirate/modules/views/AppAppBar.js index b97bce27867d5b..def0bcd579a53f 100644 --- a/docs/src/pages/premium-themes/onepirate/modules/views/AppAppBar.js +++ b/docs/src/pages/premium-themes/onepirate/modules/views/AppAppBar.js @@ -2,10 +2,9 @@ import React from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; import { withStyles } from '@material-ui/core/styles'; +import Link from '@material-ui/core/Link'; import AppBar from '../components/AppBar'; import Toolbar, { styles as toolbarStyles } from '../components/Toolbar'; -import Typography from '../components/Typography'; -import Link from '../next/Link'; const styles = theme => ({ title: { @@ -44,36 +43,33 @@ function AppAppBar(props) {
- ( - - )} + href="/premium-themes/onepirate" > {'onepirate'} - +
- ( - - )} + href="/premium-themes/onepirate/sign-in" > {'Sign In'} - - + ( - - )} + href="/premium-themes/onepirate/sign-up" > {'Sign Up'} - +
diff --git a/docs/src/pages/premium-themes/onepirate/modules/views/AppFooter.js b/docs/src/pages/premium-themes/onepirate/modules/views/AppFooter.js index 6ac35e529fd471..2204e2db32bb8c 100644 --- a/docs/src/pages/premium-themes/onepirate/modules/views/AppFooter.js +++ b/docs/src/pages/premium-themes/onepirate/modules/views/AppFooter.js @@ -4,9 +4,9 @@ import compose from 'recompose/compose'; import pure from 'recompose/pure'; import { withStyles } from '@material-ui/core/styles'; import Grid from '@material-ui/core/Grid'; +import Link from '@material-ui/core/Link'; import LayoutBody from '../components/LayoutBody'; import Typography from '../components/Typography'; -import Link from '../next/Link'; import TextField from '../components/TextField'; const styles = theme => ({ diff --git a/docs/src/pages/premium-themes/onepirate/modules/views/ProductHero.js b/docs/src/pages/premium-themes/onepirate/modules/views/ProductHero.js index 03bf7fcc92553f..2ca9ec99566d9e 100644 --- a/docs/src/pages/premium-themes/onepirate/modules/views/ProductHero.js +++ b/docs/src/pages/premium-themes/onepirate/modules/views/ProductHero.js @@ -1,9 +1,9 @@ import React from 'react'; import PropTypes from 'prop-types'; import { withStyles } from '@material-ui/core/styles'; +import Link from '@material-ui/core/Link'; import Button from '../components/Button'; import Typography from '../components/Typography'; -import Link from '../next/Link'; import ProductHeroLayout from './ProductHeroLayout'; const backgroundImage = diff --git a/docs/src/pages/premium-themes/onepirate/modules/views/ProductHowItWorks.js b/docs/src/pages/premium-themes/onepirate/modules/views/ProductHowItWorks.js index c6ec977713aad5..a2182b2bdad197 100644 --- a/docs/src/pages/premium-themes/onepirate/modules/views/ProductHowItWorks.js +++ b/docs/src/pages/premium-themes/onepirate/modules/views/ProductHowItWorks.js @@ -2,10 +2,10 @@ import React from 'react'; import PropTypes from 'prop-types'; import { withStyles } from '@material-ui/core/styles'; import Grid from '@material-ui/core/Grid'; +import Link from '@material-ui/core/Link'; import LayoutBody from '../components/LayoutBody'; import Button from '../components/Button'; import Typography from '../components/Typography'; -import Link from '../next/Link'; const styles = theme => ({ root: { diff --git a/docs/src/pages/style/color/color.md b/docs/src/pages/style/color/color.md index 4c40b93ab85789..9ecb16221318a0 100644 --- a/docs/src/pages/style/color/color.md +++ b/docs/src/pages/style/color/color.md @@ -71,7 +71,7 @@ const theme = createMuiTheme({ }); ``` -Only the `main` shades need be provided (unless you wish to further customise `light`, `dark` or `contrastText`), as the other colors will be calculated by `createMuiTheme()`, as described in the [Theme customization](/customization/themes/#palette) section. +Only the `main` shades need be provided (unless you wish to further customize `light`, `dark` or `contrastText`), as the other colors will be calculated by `createMuiTheme()`, as described in the [Theme customization](/customization/themes/#palette) section. If you are using the default primary and / or secondary shades then by providing the color object, `createMuiTheme()` will use the appropriate shades from the material color for main, light and dark. diff --git a/docs/src/pages/style/links/ButtonLink.js b/docs/src/pages/style/links/ButtonLink.js new file mode 100644 index 00000000000000..a9941c74355d3f --- /dev/null +++ b/docs/src/pages/style/links/ButtonLink.js @@ -0,0 +1,17 @@ +/* eslint-disable jsx-a11y/anchor-is-valid, no-alert */ + +import React from 'react'; +import Link from '@material-ui/core/Link'; + +export default function ButtonLink() { + return ( + { + alert("I'm a button."); + }} + > + Button Link + + ); +} diff --git a/docs/src/pages/style/links/Links.js b/docs/src/pages/style/links/Links.js new file mode 100644 index 00000000000000..b08001d0d77002 --- /dev/null +++ b/docs/src/pages/style/links/Links.js @@ -0,0 +1,38 @@ +/* eslint-disable no-script-url */ +import React from 'react'; +import PropTypes from 'prop-types'; +import { withStyles } from '@material-ui/core/styles'; +import Link from '@material-ui/core/Link'; + +const styles = theme => ({ + link: { + margin: theme.spacing.unit, + }, +}); + +// This resolves to nothing and doesn't affect browser history +const dudUrl = 'javascript:;'; + +function Links(props) { + const { classes } = props; + + return ( +
+ + Link + + + {'color="inherit"'} + + + {'variant="body1"'} + +
+ ); +} + +Links.propTypes = { + classes: PropTypes.object.isRequired, +}; + +export default withStyles(styles)(Links); diff --git a/docs/src/pages/style/links/links.md b/docs/src/pages/style/links/links.md new file mode 100644 index 00000000000000..020af7658e4a7e --- /dev/null +++ b/docs/src/pages/style/links/links.md @@ -0,0 +1,35 @@ +--- +components: Link +--- + +# Links + +

The Link component allows you to easily customize anchor elements with your theme colors and typography styles.

+ +## Simple links + +The Link component is built on top of the [Typography](/api/typography/) component. +You can leverage its properties. + +{{"demo": "pages/style/links/Links.js"}} + +## Accessibility + +- When providing the content for the link, avoid phrases like "click here" or "go to". +- For the best user experience links should stand out from the text on the page. +- If a link doesn't have a meaningful href, [it should be rendered using a `