diff --git a/docs/src/modules/components/AppNavDrawer.js b/docs/src/modules/components/AppNavDrawer.js index 58f5f694b43b00..8bd9e9dcaab517 100644 --- a/docs/src/modules/components/AppNavDrawer.js +++ b/docs/src/modules/components/AppNavDrawer.js @@ -111,25 +111,18 @@ function ProductDrawerButton(props) { minWidth: { xs: '100%', sm: 600 }, overflow: 'clip', boxShadow: `0 4px 16px ${alpha(theme.palette.common.black, 0.15)}`, - '& ul': { - margin: 0, - padding: 0, - listStyle: 'none', - }, ...theme.applyDarkStyles({ bgcolor: 'primaryDark.900', }), })} > - - - + /> diff --git a/docs/src/modules/components/MuiProductSelector.tsx b/docs/src/modules/components/MuiProductSelector.tsx index 194778b58357c9..34179744e6645e 100644 --- a/docs/src/modules/components/MuiProductSelector.tsx +++ b/docs/src/modules/components/MuiProductSelector.tsx @@ -4,6 +4,9 @@ import { styled, alpha, Theme } from '@mui/material/styles'; import Box from '@mui/material/Box'; import Typography from '@mui/material/Typography'; import Chip from '@mui/material/Chip'; +import Divider from '@mui/material/Divider'; +import MenuList, { MenuListProps } from '@mui/material/MenuList'; +import MenuItem, { MenuItemProps } from '@mui/material/MenuItem'; import ROUTES from 'docs/src/route'; import PageContext from 'docs/src/modules/components/PageContext'; import SvgMuiLogomark from 'docs/src/icons/SvgMuiLogomark'; @@ -38,7 +41,7 @@ const NavLabel = styled(Typography)(({ theme }) => ({ color: (theme.vars || theme).palette.text.tertiary, })); -interface ProductItemProps { +interface ProductItemProps extends MenuItemProps { active?: boolean; chip?: React.ReactNode; description?: string; @@ -47,44 +50,58 @@ interface ProductItemProps { name: string; } -function ProductItem({ active, chip, description, href, icon, name }: ProductItemProps) { +function ProductItem({ + active, + chip, + description, + href, + icon, + name, + sx = [], + ...other +}: ProductItemProps) { return ( - ({ - p: 1, - pl: '6px', - display: 'flex', - alignItems: 'start', - gap: '8px', - flexGrow: 1, - backgroundColor: active ? alpha(theme.palette.primary[50], 0.8) : undefined, - border: '1px solid', - borderColor: active ? 'primary.100' : 'transparent', - borderRadius: '8px', - transition: '100ms ease-in background-color, border', - textDecorationLine: 'none', - '&:hover': { - backgroundColor: active ? alpha(theme.palette.primary[50], 0.8) : 'grey.50', - borderColor: 'divider', - }, - '&:focus-visible': { - outline: `3px solid ${alpha(theme.palette.primary[500], 0.5)}`, - outlineOffset: '2px', - }, - ...theme.applyDarkStyles({ - backgroundColor: active ? alpha(theme.palette.primary[900], 0.2) : undefined, - borderColor: active ? alpha(theme.palette.primary[300], 0.2) : 'transparent', + sx={[ + (theme) => ({ + p: 1, + pl: '6px', + display: 'flex', + alignItems: 'start', + gap: '8px', + flexGrow: 1, + backgroundColor: active ? alpha(theme.palette.primary[50], 0.8) : undefined, + border: '1px solid', + borderColor: active ? 'primary.100' : 'transparent', + borderRadius: '8px', + transition: '100ms ease-in background-color, border', + textDecorationLine: 'none', '&:hover': { - backgroundColor: active - ? alpha(theme.palette.primary[900], 0.3) - : alpha(theme.palette.primaryDark[700], 0.5), + backgroundColor: active ? alpha(theme.palette.primary[50], 0.8) : 'grey.50', borderColor: 'divider', }, + '&:focus-visible': { + outline: `3px solid ${alpha(theme.palette.primary[500], 0.5)}`, + outlineOffset: '2px', + }, + ...theme.applyDarkStyles({ + backgroundColor: active ? alpha(theme.palette.primary[900], 0.2) : undefined, + borderColor: active ? alpha(theme.palette.primary[300], 0.2) : 'transparent', + '&:hover': { + backgroundColor: active + ? alpha(theme.palette.primary[900], 0.3) + : alpha(theme.palette.primaryDark[700], 0.5), + borderColor: 'divider', + }, + }), }), - })} + // You cannot spread `sx` directly because `SxProps` (typeof sx) can be an array. + ...(Array.isArray(sx) ? sx : [sx]), + ]} + {...other} > - + ); } @@ -177,92 +194,106 @@ const advancedProducts = [ }, ]; -export default function MuiProductSelector() { +export default function MuiProductSelector(props: MenuListProps) { const pageContext = React.useContext(PageContext); return ( - - + {coreProducts.map((product) => ( + + ))} + - {coreProducts.map((product) => ( - - ))} - + /> MUI X Components - - {advancedProducts.map((product) => ( - - ))} - - + {advancedProducts.map((product) => ( } - description="A self-hosted, low-code internal tool builder." - active={pageContext.productId === 'toolpad-core'} - chip={ - - } + key={product.name} + name={product.name} + description={product.description} + icon={product.icon} + href={product.href} + active={pageContext.productId === product.id} /> - - + ))} + + } + description="A self-hosted, low-code internal tool builder." + active={pageContext.productId === 'toolpad-core'} + chip={ + + } + sx={{ + gridColumn: { + xs: '1 / span 1', + sm: '1 / span 2', + }, + }} + /> + ); }