diff --git a/docs/src/components/home/ToolpadCoreShowcaseDemo.tsx b/docs/src/components/home/ToolpadCoreShowcaseDemo.tsx index 380fe6d8dca99d..21c05b0e570e47 100644 --- a/docs/src/components/home/ToolpadCoreShowcaseDemo.tsx +++ b/docs/src/components/home/ToolpadCoreShowcaseDemo.tsx @@ -1,5 +1,4 @@ import * as React from 'react'; -import Paper from '@mui/material/Paper'; import DashboardIcon from '@mui/icons-material/Dashboard'; import ShoppingCartIcon from '@mui/icons-material/ShoppingCart'; import BarChartIcon from '@mui/icons-material/BarChart'; @@ -73,7 +72,7 @@ const PlaceHolder = styled('div')<{ height: number }>(({ theme, height }) => ({ function DashboardLayoutBasic(props: DemoProps) { const { window } = props; - const [pathname, setPathname] = React.useState('/page'); + const [pathname, setPathname] = React.useState('/dashboard'); const router = React.useMemo(() => { return { @@ -108,24 +107,8 @@ function DashboardLayoutBasic(props: DemoProps) { export default function ToolpadDashboardLayout() { return ( - ({ - display: 'flex', - alignItems: 'center', - maxWidth: '100%', - mx: 'auto', - bgcolor: '#FFF', - borderRadius: '8px', - overflow: 'hidden', - ...theme.applyDarkStyles({ - bgcolor: 'primaryDark.900', - }), - })} - > - - - - + + + ); } diff --git a/docs/src/components/home/ToolpadShowcase.tsx b/docs/src/components/home/ToolpadShowcase.tsx index 12ec7225b2d8d2..a2bcbf435e9ff9 100644 --- a/docs/src/components/home/ToolpadShowcase.tsx +++ b/docs/src/components/home/ToolpadShowcase.tsx @@ -52,18 +52,46 @@ spec: - component: codeComponent.map name: map `; + +interface TabContainerProps { + index: number; + value: number; + isDemo: boolean; + children: React.ReactNode; +} + +function TabContainer({ index, value, isDemo, children }: TabContainerProps) { + return ( + ({ + width: '100%', + maxWidth: '100%', + height: 260, + display: value === index ? 'flex' : 'none', + overflow: isDemo ? 'auto' : 'clip', + bgcolor: '#FFF', + borderRadius: '8px', + boxShadow: `0 4px 8px ${alpha(theme.palette.common.black, 0.1)}`, + borderColor: 'grey.200', + ...(isDemo && { scrollbarGutter: 'stable' }), + })} + > + {children} + + ); +} + interface ImageProps { alt: string; - index: number; src: string; - value: number; } -function Image({ alt, index, src, value }: ImageProps) { +function Image({ alt, src }: ImageProps) { return ( - } - > - - - + +

Loading...

+ + } + > + +
); } @@ -201,32 +227,17 @@ export default function ToolpadShowcase() { ))} - ({ - width: '100%', - height: 260, - overflow: 'auto', - scrollbarGutter: 'stable', - boxShadow: `0 4px 8px ${alpha(theme.palette.common.black, 0.1)}`, - borderColor: 'grey.200', - borderRadius: '8px', - })} - > - {tabsCodeInfo.map((tab, index) => - tab.Demo ? ( - - ) : ( - {tab.imgAlt} - ), - )} - + {tabsCodeInfo.map((tab, index) => + tab.Demo ? ( + + + + ) : ( + + {tab.imgAlt} + + ), + )} }