From b56ddbd589293149c8fc83184e1543715d986601 Mon Sep 17 00:00:00 2001 From: Danilo Leal <67129314+danilo-leal@users.noreply.github.com> Date: Mon, 12 Feb 2024 21:33:24 -0300 Subject: [PATCH 01/13] improving the Player Card demo component --- .../productMaterial/MaterialTheming.tsx | 34 +++++++-------- docs/src/components/showcase/PlayerCard.tsx | 43 +++++++++---------- 2 files changed, 35 insertions(+), 42 deletions(-) diff --git a/docs/src/components/productMaterial/MaterialTheming.tsx b/docs/src/components/productMaterial/MaterialTheming.tsx index 65907d826eeef0..2ae241552fbb78 100644 --- a/docs/src/components/productMaterial/MaterialTheming.tsx +++ b/docs/src/components/productMaterial/MaterialTheming.tsx @@ -31,48 +31,44 @@ const code = ` width="100" height="100" alt="Contemplative Reptile album cover" - src="/static/images/cards/contemplative-reptile.jpg" + src="/images/contemplative-reptile.jpg" sx={{ width: { xs: '100%', sm: 100 }, - borderRadius: 0.6, }} /> - - - + +
+ Contemplative Reptile Sounds of Nature - - - +
+ + - + setPaused((val) => !val)} + sx={{ mx: 1 }} > {paused ? : } - + - + diff --git a/docs/src/components/showcase/PlayerCard.tsx b/docs/src/components/showcase/PlayerCard.tsx index 1e29fbbe51769c..726023bd1ef2bd 100644 --- a/docs/src/components/showcase/PlayerCard.tsx +++ b/docs/src/components/showcase/PlayerCard.tsx @@ -32,13 +32,10 @@ export default function PlayerCard({ display: 'flex', flexDirection: { xs: 'column', sm: 'row' }, alignItems: 'center', - borderColor: extraStyles ? 'primary.200' : 'grey.200', gap: 2, - boxShadow: (theme) => - extraStyles - ? '0 2px 4px rgba(0, 127, 255, 0.2)' - : `0px 4px 8px ${alpha(theme.palette.grey[200], 0.6)}`, ...(!disableTheming && { + borderColor: 'divider', + boxShadow: (theme) => `0px 4px 8px ${alpha(theme.palette.grey[200], 0.6)}`, [`& .${iconButtonClasses.root}`]: { border: '1px solid', bgcolor: 'primary.50', @@ -61,10 +58,7 @@ export default function PlayerCard({ ((theme) => theme.applyDarkStyles({ bgcolor: 'primaryDark.900', - borderColor: extraStyles ? 'primary.800' : 'primaryDark.700', - boxShadow: extraStyles - ? '0 2px 4px rgba(0, 127, 255, 0.2)' - : '0px 4px 8px rgba(0, 0, 0, 0.4)', + boxShadow: '0px 4px 8px rgba(0, 0, 0, 0.4)', [`& .${iconButtonClasses.root}`]: { bgcolor: 'primary.900', color: 'primary.200', @@ -90,41 +84,44 @@ export default function PlayerCard({ src="/static/images/cards/contemplative-reptile.jpg" sx={{ width: { xs: '100%', sm: 100 }, - borderRadius: 0.6, + ...(!disableTheming && { + borderRadius: '6px', + }), }} /> - - - + +
+ Contemplative Reptile Sounds of Nature - - - +
+ + - + setPaused((val) => !val)} + sx={{ mx: 1 }} > {paused ? : } - + - + From dc896aaad5fac542d93e8c43d4d7cbcd04f91228 Mon Sep 17 00:00:00 2001 From: Danilo Leal <67129314+danilo-leal@users.noreply.github.com> Date: Mon, 12 Feb 2024 21:33:45 -0300 Subject: [PATCH 02/13] improving the Real Estate styling demo component and section --- .../productMaterial/MaterialStyling.tsx | 24 ++++++++----------- .../components/showcase/RealEstateCard.tsx | 12 ++++++---- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/docs/src/components/productMaterial/MaterialStyling.tsx b/docs/src/components/productMaterial/MaterialStyling.tsx index b26d938a3fb7d8..db719db9b23223 100644 --- a/docs/src/components/productMaterial/MaterialStyling.tsx +++ b/docs/src/components/productMaterial/MaterialStyling.tsx @@ -19,13 +19,10 @@ const code = ` - + 123 Main St, Phoenix, AZ @@ -55,6 +50,7 @@ const code = ` pl: 0.5, pr: 1, typography: 'caption', + fontWeight: 'semiBold', borderRadius: 10, display: 'flex', bgcolor: 'primary.50', @@ -74,9 +70,9 @@ const code = ` `; -const startLine = [34, 25, 6]; -const endLine = [48, 30, 8]; -const scrollTo = [540, 320, 0]; +const startLine = [29, 21, 17]; +const endLine = [46, 26, 17]; +const scrollTo = [540, 320, 200]; export const useResizeHandle = ( target: React.MutableRefObject, diff --git a/docs/src/components/showcase/RealEstateCard.tsx b/docs/src/components/showcase/RealEstateCard.tsx index 7f89952d59da2e..5bfbb8a2389637 100644 --- a/docs/src/components/showcase/RealEstateCard.tsx +++ b/docs/src/components/showcase/RealEstateCard.tsx @@ -1,4 +1,5 @@ import * as React from 'react'; +import { alpha } from '@mui/material/styles'; import Box from '@mui/material/Box'; import Card, { CardProps } from '@mui/material/Card'; import CardMedia from '@mui/material/CardMedia'; @@ -12,14 +13,14 @@ export default function RealEstateCard({ sx, ...props }: CardProps) { {...props} sx={[ (theme) => ({ + p: 2, display: 'flex', flexWrap: 'wrap', - p: 2, zIndex: 1, - boxShadow: '0 2px 4px rgba(0, 127, 255, 0.1)', + boxShadow: (theme) => `0px 4px 8px ${alpha(theme.palette.grey[200], 0.6)}`, ...theme.applyDarkStyles({ bgcolor: 'primaryDark.900', - boxShadow: '0 2px 4px rgba(0, 0, 0, 0.8)', + boxShadow: '0px 4px 8px rgba(0, 0, 0, 0.4)', }), }), ...(Array.isArray(sx) ? sx : [sx]), @@ -32,13 +33,13 @@ export default function RealEstateCard({ sx, ...props }: CardProps) { alt="123 Main St, Phoenix, AZ cover" src="/static/images/cards/real-estate.png" sx={{ - borderRadius: 0.5, + borderRadius: '6px', width: 'clamp(100px, (304px - 100%) * 999 , 100%)', }} /> - + 123 Main St, Phoenix, AZ @@ -51,6 +52,7 @@ export default function RealEstateCard({ sx, ...props }: CardProps) { pl: 0.5, pr: 1, typography: 'caption', + fontWeight: 'semiBold', borderRadius: 10, display: 'flex', bgcolor: 'primary.50', From f2d5bdc12fe2a877e40df10ba11ee2c03c6a83f1 Mon Sep 17 00:00:00 2001 From: Danilo Leal <67129314+danilo-leal@users.noreply.github.com> Date: Mon, 12 Feb 2024 21:41:16 -0300 Subject: [PATCH 03/13] fix highlight container for correct focus-visible style display --- docs/src/components/productMaterial/MaterialComponents.tsx | 2 +- docs/src/components/productMaterial/MaterialStyling.tsx | 2 +- docs/src/components/productMaterial/MaterialTemplates.tsx | 3 ++- docs/src/components/productMaterial/MaterialTheming.tsx | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/src/components/productMaterial/MaterialComponents.tsx b/docs/src/components/productMaterial/MaterialComponents.tsx index 81a7036fac7d60..eb75b26cd0af63 100644 --- a/docs/src/components/productMaterial/MaterialComponents.tsx +++ b/docs/src/components/productMaterial/MaterialComponents.tsx @@ -151,7 +151,7 @@ export default function MaterialComponents() { } description="A meticulous implementation of Material Design; every Material UI component meets the highest standards of form and function." /> - + {DEMOS.map((name) => ( setDemo(name)}> diff --git a/docs/src/components/productMaterial/MaterialStyling.tsx b/docs/src/components/productMaterial/MaterialStyling.tsx index db719db9b23223..aaed716cd64671 100644 --- a/docs/src/components/productMaterial/MaterialStyling.tsx +++ b/docs/src/components/productMaterial/MaterialStyling.tsx @@ -176,7 +176,7 @@ export default function MaterialStyling() { } description="CSS utilities allow you to move faster and make for a smooth developer experience when styling any component." /> - + setIndex(0)}> } diff --git a/docs/src/components/productMaterial/MaterialTemplates.tsx b/docs/src/components/productMaterial/MaterialTemplates.tsx index e53b1e2144d26a..554a56b69b1620 100644 --- a/docs/src/components/productMaterial/MaterialTemplates.tsx +++ b/docs/src/components/productMaterial/MaterialTemplates.tsx @@ -140,7 +140,7 @@ export default function MaterialTemplates() { } description="A carefully curated collection of gorgeous, fully functional templates, all powered by Material UI." /> - + {DEMOS.map((name) => ( ))} diff --git a/docs/src/components/productMaterial/MaterialTheming.tsx b/docs/src/components/productMaterial/MaterialTheming.tsx index 2ae241552fbb78..4a046002a453f5 100644 --- a/docs/src/components/productMaterial/MaterialTheming.tsx +++ b/docs/src/components/productMaterial/MaterialTheming.tsx @@ -90,7 +90,7 @@ export default function MaterialTheming() { } description="Start quickly with Material Design or use the advanced theming feature to easily tailor the components to your needs." /> - + setCustomized(true)}> } From 23ccb90950b368b5ecfac758c5fdacb554438312 Mon Sep 17 00:00:00 2001 From: Danilo Leal <67129314+danilo-leal@users.noreply.github.com> Date: Mon, 12 Feb 2024 21:41:30 -0300 Subject: [PATCH 04/13] add handy prop on the Item component for better icon spacing --- docs/src/components/action/Item.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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} From 2470d53dcb8f26337f836fc925c9184acbad1441 Mon Sep 17 00:00:00 2001 From: Danilo Leal <67129314+danilo-leal@users.noreply.github.com> Date: Mon, 12 Feb 2024 21:50:48 -0300 Subject: [PATCH 05/13] standardizing the Material Design vs. Custom theme button design (clean-up) --- docs/src/components/action/StylingInfo.tsx | 3 +- docs/src/components/home/CoreShowcase.tsx | 2 +- .../productMaterial/MaterialComponents.tsx | 60 ++++++++----------- 3 files changed, 26 insertions(+), 39 deletions(-) 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/productMaterial/MaterialComponents.tsx b/docs/src/components/productMaterial/MaterialComponents.tsx index eb75b26cd0af63..bf1cfa6ad0fae7 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: ` - From c75947df4a720dbf2a3bb9d5ccf957a8ae237d7a Mon Sep 17 00:00:00 2001 From: Danilo Leal <67129314+danilo-leal@users.noreply.github.com> Date: Mon, 12 Feb 2024 21:53:43 -0300 Subject: [PATCH 06/13] small tweaks to the Table demo --- docs/src/components/home/MaterialDesignComponents.tsx | 6 +++--- docs/src/components/productMaterial/MaterialComponents.tsx | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) 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 bf1cfa6ad0fae7..3abc1df7a2ad0a 100644 --- a/docs/src/components/productMaterial/MaterialComponents.tsx +++ b/docs/src/components/productMaterial/MaterialComponents.tsx @@ -187,7 +187,7 @@ export default function MaterialComponents() { sx={{ mx: 'auto', my: 4, - maxWidth: 320, + maxWidth: '90%', '& .MuiTableBody-root > .MuiTableRow-root:last-of-type > .MuiTableCell-root': { borderBottomWidth: 0, From 55b000e2a16d6147697d7496b7a2804dd7949c1e Mon Sep 17 00:00:00 2001 From: Danilo Leal <67129314+danilo-leal@users.noreply.github.com> Date: Mon, 12 Feb 2024 21:59:09 -0300 Subject: [PATCH 07/13] fine-tune to the Styling section code highlight --- .../productMaterial/MaterialStyling.tsx | 20 ++++++++++--------- .../components/showcase/RealEstateCard.tsx | 6 +++--- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/docs/src/components/productMaterial/MaterialStyling.tsx b/docs/src/components/productMaterial/MaterialStyling.tsx index aaed716cd64671..87107108845660 100644 --- a/docs/src/components/productMaterial/MaterialStyling.tsx +++ b/docs/src/components/productMaterial/MaterialStyling.tsx @@ -2,7 +2,9 @@ import * as React from 'react'; import Box from '@mui/material/Box'; import Grid from '@mui/material/Grid'; import Typography from '@mui/material/Typography'; -import AutoAwesomeRounded from '@mui/icons-material/AutoAwesomeRounded'; +import DevicesOtherRoundedIcon from '@mui/icons-material/DevicesOtherRounded'; +import ContrastRoundedIcon from '@mui/icons-material/ContrastRounded'; +import SwitchAccessShortcutRoundedIcon from '@mui/icons-material/SwitchAccessShortcutRounded'; import DragHandleRounded from '@mui/icons-material/DragHandleRounded'; import Section from 'docs/src/layouts/Section'; import SectionHeadline from 'docs/src/components/typography/SectionHeadline'; @@ -49,12 +51,12 @@ const code = ` py: 0.4, pl: 0.5, pr: 1, + borderRadius: 12, + display: 'flex', + border: '1px solid', typography: 'caption', fontWeight: 'semiBold', - borderRadius: 10, - display: 'flex', bgcolor: 'primary.50', - border: '1px solid', borderColor: 'primary.100', color: 'primary.700', ...theme.applyDarkStyles({ @@ -70,8 +72,8 @@ const code = ` `; -const startLine = [29, 21, 17]; -const endLine = [46, 26, 17]; +const startLine = [36, 21, 17]; +const endLine = [44, 26, 17]; const scrollTo = [540, 320, 200]; export const useResizeHandle = ( @@ -179,21 +181,21 @@ export default function MaterialStyling() { setIndex(0)}> } + icon={} title="Leverage the tokens from your theme" description="Easily use the design tokens defined in your theme for any CSS property out there." /> setIndex(1)}> } + icon={} title="No context switching" description="The styling and component usage are both in the same place, right where you need them." /> setIndex(2)}> } + icon={} title="Responsive styles right inside system prop" description="An elegant API for writing CSS media queries that match your theme breakpoints." /> diff --git a/docs/src/components/showcase/RealEstateCard.tsx b/docs/src/components/showcase/RealEstateCard.tsx index 5bfbb8a2389637..740d6b67544ef4 100644 --- a/docs/src/components/showcase/RealEstateCard.tsx +++ b/docs/src/components/showcase/RealEstateCard.tsx @@ -51,12 +51,12 @@ export default function RealEstateCard({ sx, ...props }: CardProps) { py: 0.4, pl: 0.5, pr: 1, + display: 'flex', + borderRadius: 12, + border: '1px solid', typography: 'caption', fontWeight: 'semiBold', - borderRadius: 10, - display: 'flex', bgcolor: 'primary.50', - border: '1px solid', borderColor: 'primary.100', color: 'primary.700', ...theme.applyDarkStyles({ From 4e238223fb2b9ccccaf289c87123a02c87dbb297 Mon Sep 17 00:00:00 2001 From: Danilo Leal <67129314+danilo-leal@users.noreply.github.com> Date: Mon, 12 Feb 2024 22:08:36 -0300 Subject: [PATCH 08/13] useFlexGap on the hero section Stack components --- docs/src/components/productMaterial/MaterialHero.tsx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) 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' } }} + >