diff --git a/docs/src/modules/components/AppDrawer.js b/docs/src/modules/components/AppDrawer.js index 498b07a472d9b2..f8097ee0e675da 100644 --- a/docs/src/modules/components/AppDrawer.js +++ b/docs/src/modules/components/AppDrawer.js @@ -22,7 +22,7 @@ function PersistScroll(props) { React.useEffect(() => { const parent = rootRef.current ? rootRef.current.parentElement : null; - const activeElement = document.querySelector('.drawer-active'); + const activeElement = document.querySelector('.app-drawer-active'); if (!parent || !activeElement || !activeElement.scrollIntoView) { return undefined; @@ -82,7 +82,7 @@ function renderNavItems(options) { const { pages, ...params } = options; return ( - + {pages.reduce( // eslint-disable-next-line @typescript-eslint/no-use-before-define (items, page) => reduceChildRoutes({ items, page, ...params }), diff --git a/docs/src/modules/components/AppDrawerNavItem.js b/docs/src/modules/components/AppDrawerNavItem.js index 5c6d6145470775..d5e749386c9001 100644 --- a/docs/src/modules/components/AppDrawerNavItem.js +++ b/docs/src/modules/components/AppDrawerNavItem.js @@ -1,43 +1,83 @@ import * as React from 'react'; import PropTypes from 'prop-types'; import clsx from 'clsx'; -import { makeStyles } from '@material-ui/core/styles'; -import ListItem from '@material-ui/core/ListItem'; -import Button from '@material-ui/core/Button'; +import { makeStyles, fade } from '@material-ui/core/styles'; import Collapse from '@material-ui/core/Collapse'; +import ButtonBase from '@material-ui/core/ButtonBase'; +import ArrowRightIcon from '@material-ui/icons/ArrowRight'; import Link from 'docs/src/modules/components/Link'; const useStyles = makeStyles((theme) => ({ - item: { + li: { + padding: '1px 0', display: 'block', - paddingTop: 0, - paddingBottom: 0, }, - itemLeaf: { - display: 'flex', - paddingTop: 0, - paddingBottom: 0, + liRoot: { + padding: '0 8px', }, - button: { - letterSpacing: 0, - justifyContent: 'flex-start', - textTransform: 'none', + item: { + ...theme.typography.body2, + display: 'flex', + borderRadius: theme.shape.borderRadius, + outline: 0, width: '100%', - }, - buttonLeaf: { - letterSpacing: 0, + padding: '8px 0', justifyContent: 'flex-start', - textTransform: 'none', - width: '100%', - fontWeight: theme.typography.fontWeightRegular, - '&.depth-0': { - fontWeight: theme.typography.fontWeightMedium, + fontWeight: theme.typography.fontWeightMedium, + transition: theme.transitions.create(['color', 'background-color'], { + duration: theme.transitions.duration.shortest, + }), + '&:hover': { + color: theme.palette.text.primary, + backgroundColor: fade(theme.palette.text.primary, theme.palette.action.hoverOpacity), + }, + '&.Mui-focusVisible': { + backgroundColor: theme.palette.action.focus, + }, + [theme.breakpoints.up('md')]: { + padding: '6px 0', }, }, - active: { - color: theme.palette.primary.main, + button: { + color: theme.palette.text.primary, fontWeight: theme.typography.fontWeightMedium, + '& svg': { + fontSize: 18, + marginLeft: -19, + color: theme.palette.text.secondary, + }, + '& svg$open': { + transform: 'rotate(90deg)', + }, + '&:hover svg': { + color: theme.palette.text.primary, + }, + }, + open: {}, + link: { + color: theme.palette.text.secondary, + '&.app-drawer-active': { + color: theme.palette.primary.main, + backgroundColor: fade(theme.palette.primary.main, theme.palette.action.selectedOpacity), + '&:hover': { + backgroundColor: fade( + theme.palette.primary.main, + theme.palette.action.selectedOpacity + theme.palette.action.hoverOpacity, + ), + // Reset on touch devices, it doesn't add specificity + '@media (hover: none)': { + backgroundColor: fade(theme.palette.primary.main, theme.palette.action.selectedOpacity), + }, + }, + '&.Mui-focusVisible': { + backgroundColor: fade( + theme.palette.primary.main, + theme.palette.action.selectedOpacity + theme.palette.action.focusOpacity, + ), + }, + }, }, + active: {}, })); export default function AppDrawerNavItem(props) { @@ -60,47 +100,54 @@ export default function AppDrawerNavItem(props) { }; const style = { - paddingLeft: 8 * (3 + 2 * depth), + paddingLeft: 8 * (3 + 1.5 * depth), }; if (href) { return ( - - - + + ); } return ( - - + {children} - + ); } diff --git a/docs/src/modules/components/Link.js b/docs/src/modules/components/Link.js index 6c515bbca9dd0c..414be77d14778b 100644 --- a/docs/src/modules/components/Link.js +++ b/docs/src/modules/components/Link.js @@ -55,6 +55,10 @@ function Link(props) { const isExternal = href.indexOf('https:') === 0 || href.indexOf('mailto:') === 0; if (isExternal) { + if (naked) { + return ; + } + return ; } diff --git a/docs/src/pages.js b/docs/src/pages.js index c2ae0f6e6d0897..7d255b0ec3aad0 100644 --- a/docs/src/pages.js +++ b/docs/src/pages.js @@ -275,7 +275,7 @@ const pages = [ { pathname: '/discover-more/languages' }, ], }, - { pathname: '/versions', disableNav: true }, + { pathname: '/versions', displayNav: false }, { pathname: '/', displayNav: false, disableDrawer: true }, { pathname: 'https://medium.com/material-ui', title: 'Blog' }, ];