From af0793687035d77b8383c79fa5a2607ea621dba7 Mon Sep 17 00:00:00 2001 From: Danilo Leal <67129314+danilo-leal@users.noreply.github.com> Date: Thu, 15 Feb 2024 13:14:03 -0300 Subject: [PATCH 1/3] [website] Add overall improvements to the Material UI page (#41075) --- docs/src/components/action/Highlighter.tsx | 11 ++- docs/src/components/action/Item.tsx | 9 ++- docs/src/components/action/StylingInfo.tsx | 3 +- docs/src/components/home/CoreShowcase.tsx | 2 +- .../home/MaterialDesignComponents.tsx | 6 +- .../productMaterial/MaterialComponents.tsx | 64 +++++++--------- .../productMaterial/MaterialHero.tsx | 11 ++- .../productMaterial/MaterialStyling.tsx | 73 ++++++++----------- .../productMaterial/MaterialTemplates.tsx | 3 +- .../productMaterial/MaterialTheming.tsx | 38 +++++----- docs/src/components/showcase/PlayerCard.tsx | 51 ++++++------- .../components/showcase/RealEstateCard.tsx | 45 ++++++------ 12 files changed, 145 insertions(+), 171 deletions(-) diff --git a/docs/src/components/action/Highlighter.tsx b/docs/src/components/action/Highlighter.tsx index 727cc54b6fe57f..1ea42e4b6882cc 100644 --- a/docs/src/components/action/Highlighter.tsx +++ b/docs/src/components/action/Highlighter.tsx @@ -45,7 +45,6 @@ export default function Highlighter({ transitionProperty: 'all', transitionDuration: '100ms', color: 'primary.300', - overflow: 'auto', ...((!disableBorder || selected) && { borderColor: 'grey.100', }), @@ -59,13 +58,16 @@ export default function Highlighter({ color: 'primary.500', }), ...(!selected && { - '&:hover, &:focus': { + '&:hover': { bgcolor: 'primary.50', borderColor: 'primary.100', '@media (hover: none)': { bgcolor: 'transparent', }, }, + '&:focus': { + bgcolor: 'transparent', + }, }), ...theme.applyDarkStyles({ color: 'primary.800', @@ -73,13 +75,16 @@ export default function Highlighter({ borderColor: alpha(theme.palette.primaryDark[600], 0.3), }), ...(!selected && { - '&:hover, &:focus': { + '&:hover': { bgcolor: alpha(theme.palette.primary[900], 0.1), borderColor: alpha(theme.palette.primary[800], 0.4), '@media (hover: none)': { bgcolor: 'transparent', }, }, + '&:focus': { + bgcolor: 'transparent', + }, }), ...(selected && { bgcolor: alpha(theme.palette.primary[800], 0.2), diff --git a/docs/src/components/action/Item.tsx b/docs/src/components/action/Item.tsx index 27c7f61eada1e9..4385f5573a84ba 100644 --- a/docs/src/components/action/Item.tsx +++ b/docs/src/components/action/Item.tsx @@ -72,14 +72,16 @@ export function Group({ } export default function Item({ + description, icon, title, - description, + smallerIconDistance = false, ...props }: { + description?: string; icon: React.ReactNode; title: string; - description?: string; + smallerIconDistance?: boolean; } & BoxProps) { return ( - + {icon} diff --git a/docs/src/components/action/StylingInfo.tsx b/docs/src/components/action/StylingInfo.tsx index 2ceb1e303da83a..e67cf63941c5ce 100644 --- a/docs/src/components/action/StylingInfo.tsx +++ b/docs/src/components/action/StylingInfo.tsx @@ -37,8 +37,7 @@ export default function StylingInfo({ transition: '0.3s', left: 0, right: 0, - px: 2, - pt: 1, + p: 2, background: ({ palette }) => alpha(palette.common.black, 0.5), backdropFilter: 'blur(8px)', zIndex: 1, diff --git a/docs/src/components/home/CoreShowcase.tsx b/docs/src/components/home/CoreShowcase.tsx index 28bc24fbdba944..b2483ab7abe165 100644 --- a/docs/src/components/home/CoreShowcase.tsx +++ b/docs/src/components/home/CoreShowcase.tsx @@ -190,7 +190,7 @@ export default function CoreShowcase() { code={componentCode} language="jsx" /> - + diff --git a/docs/src/components/home/MaterialDesignComponents.tsx b/docs/src/components/home/MaterialDesignComponents.tsx index fcb937b5e75b8d..ead70ff8dc866f 100644 --- a/docs/src/components/home/MaterialDesignComponents.tsx +++ b/docs/src/components/home/MaterialDesignComponents.tsx @@ -453,11 +453,11 @@ export function buildTheme(): ThemeOptions { MuiTableHead: { styleOverrides: { root: ({ theme }) => ({ - padding: 10, + padding: 8, backgroundColor: alpha(theme.palette.grey[50], 0.5), borderColor: (theme.vars || theme).palette.divider, ...theme.applyDarkStyles({ - backgroundColor: alpha(theme.palette.primaryDark[600], 0.5), + backgroundColor: alpha(theme.palette.primaryDark[700], 0.5), }), }), }, @@ -465,7 +465,7 @@ export function buildTheme(): ThemeOptions { MuiTableCell: { styleOverrides: { root: ({ theme }) => ({ - padding: 10, + padding: 8, borderColor: (theme.vars || theme).palette.divider, }), }, diff --git a/docs/src/components/productMaterial/MaterialComponents.tsx b/docs/src/components/productMaterial/MaterialComponents.tsx index 81a7036fac7d60..3abc1df7a2ad0a 100644 --- a/docs/src/components/productMaterial/MaterialComponents.tsx +++ b/docs/src/components/productMaterial/MaterialComponents.tsx @@ -1,8 +1,8 @@ import * as React from 'react'; -import { Experimental_CssVarsProvider as CssVarsProvider, styled } from '@mui/material/styles'; +import { Experimental_CssVarsProvider as CssVarsProvider, alpha } from '@mui/material/styles'; import Box from '@mui/material/Box'; import Alert from '@mui/material/Alert'; -import Button from '@mui/material/Button'; +import Button, { buttonClasses } from '@mui/material/Button'; import Grid from '@mui/material/Grid'; import Stack from '@mui/material/Stack'; import Paper from '@mui/material/Paper'; @@ -36,29 +36,6 @@ import ROUTES from 'docs/src/route'; const DEMOS = ['Button', 'Text field', 'Table', 'Alert', 'Tooltip'] as const; -const StyledButton = styled(Button)(({ theme }) => ({ - borderRadius: 40, - padding: theme.spacing('2px', 1), - fontSize: theme.typography.pxToRem(12), - lineHeight: 18 / 12, - '&.MuiButton-text': { - color: theme.palette.grey[500], - border: '1px solid', - borderColor: theme.palette.primaryDark[700], - '&:hover': { - backgroundColor: theme.palette.primaryDark[700], - }, - }, - '&.MuiButton-outlined': { - color: '#fff', - backgroundColor: theme.palette.primary[800], - borderColor: theme.palette.primary[700], - '&:hover': { - backgroundColor: theme.palette.primary[700], - }, - }, -})); - const CODES = { Button: ` - diff --git a/docs/src/components/productMaterial/MaterialHero.tsx b/docs/src/components/productMaterial/MaterialHero.tsx index 3a4ae3427b5780..ea1bf4a200ead9 100644 --- a/docs/src/components/productMaterial/MaterialHero.tsx +++ b/docs/src/components/productMaterial/MaterialHero.tsx @@ -294,7 +294,7 @@ export default function MaterialHero() { }, }} > - +
- .MuiPaper-root': { maxWidth: 'none' } }}> + .MuiPaper-root': { maxWidth: 'none' } }} + >