Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs] Link Toolpad Core components from Material Ui docs #43036

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
cf0c2a4
add-four-links
prakhargupta1 Jul 23, 2024
423ef56
edits
prakhargupta1 Jul 23, 2024
56328ab
add to templates
prakhargupta1 Jul 23, 2024
904d637
experimental-apis
prakhargupta1 Jul 25, 2024
6f1e204
Merge remote-tracking branch 'upstream/next' into link-toolpad-compon…
prakhargupta1 Jul 25, 2024
7aff0b0
Update pnpm-lock.yaml
prakhargupta1 Jul 25, 2024
e9e3305
Update pnpm-lock.yaml
prakhargupta1 Jul 25, 2024
2c1668a
lint
prakhargupta1 Jul 25, 2024
d8a71d8
lint
prakhargupta1 Jul 25, 2024
f9422cd
pnpm docs:typescript:formatted
prakhargupta1 Jul 25, 2024
a66918b
Update pnpm-lock.yaml
prakhargupta1 Jul 25, 2024
2578fca
add page container
prakhargupta1 Jul 26, 2024
6aacaf0
Update next.config.mjs
Janpot Jul 26, 2024
dcc14fb
Update BasicPageContainer.tsx.preview
Janpot Jul 26, 2024
462bb62
Merge branch 'next' into pr/43036
Janpot Jul 31, 2024
f355b7f
gergr
Janpot Jul 31, 2024
d7d52a6
fwrf
Janpot Jul 31, 2024
69873f7
Skeleton content
Janpot Aug 1, 2024
6dd4d5b
update copy
Janpot Aug 1, 2024
c3f66c8
Update DashboardLayoutBasic.js
Janpot Aug 1, 2024
83520ac
Update DashboardLayoutBasic.js
Janpot Aug 1, 2024
b1c28a5
types
Janpot Aug 1, 2024
6a92878
moduleResolution
Janpot Aug 1, 2024
68da77e
vale
Janpot Aug 2, 2024
973cf25
fix lnt
Janpot Aug 2, 2024
9a7197c
Update DashboardLayoutBasic.tsx
Janpot Aug 2, 2024
7e8016c
page container demos
Janpot Aug 2, 2024
5050852
naming
Janpot Aug 2, 2024
ca7c477
Merge branch 'next' into pr/43036
Janpot Aug 5, 2024
b158306
fix lint
Janpot Aug 5, 2024
56248db
Update templates.md
prakhargupta1 Aug 5, 2024
79cf8f6
lint
prakhargupta1 Aug 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
150 changes: 150 additions & 0 deletions docs/data/material/components/app-bar/DashboardLayoutBasic.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
import * as React from 'react';
import { extendTheme, styled } from '@mui/material/styles';
import DashboardIcon from '@mui/icons-material/Dashboard';
import ShoppingCartIcon from '@mui/icons-material/ShoppingCart';
import BarChartIcon from '@mui/icons-material/BarChart';
import DescriptionIcon from '@mui/icons-material/Description';
import LayersIcon from '@mui/icons-material/Layers';
import { AppProvider } from '@toolpad/core/AppProvider';
import { DashboardLayout } from '@toolpad/core/DashboardLayout';
import { PageContainer } from '@toolpad/core/PageContainer';
import Grid from '@mui/material/Grid2';

const NAVIGATION = [
{
kind: 'header',
title: 'Main items',
},
{
segment: 'dashboard',
title: 'Dashboard',
icon: <DashboardIcon />,
},
{
segment: 'orders',
title: 'Orders',
icon: <ShoppingCartIcon />,
},
{
kind: 'divider',
},
{
kind: 'header',
title: 'Analytics',
},
{
segment: 'reports',
title: 'Reports',
icon: <BarChartIcon />,
children: [
{
segment: 'sales',
title: 'Sales',
icon: <DescriptionIcon />,
},
{
segment: 'traffic',
title: 'Traffic',
icon: <DescriptionIcon />,
},
],
},
{
segment: 'integrations',
title: 'Integrations',
icon: <LayersIcon />,
},
];

const demoTheme = extendTheme({
colorSchemes: { light: true, dark: true },
colorSchemeSelector: 'class',
breakpoints: {
values: {
xs: 0,
sm: 600,
md: 600,
lg: 1200,
xl: 1536,
},
},
});

function useDemoRouter(initialPath) {
const [pathname, setPathname] = React.useState(initialPath);

const router = React.useMemo(() => {
return {
pathname,
searchParams: new URLSearchParams(),
navigate: (path) => setPathname(String(path)),
};
}, [pathname]);

return router;
}

const Skeleton = styled('div')(({ theme, height }) => ({
backgroundColor: theme.palette.action.hover,
borderRadius: theme.shape.borderRadius,
height,
content: '" "',
}));

export default function DashboardLayoutBasic(props) {
const { window } = props;

const router = useDemoRouter('/dashboard');

// Remove this const when copying and pasting into your project.
const demoWindow = window !== undefined ? window() : undefined;

return (
<AppProvider
navigation={NAVIGATION}
router={router}
theme={demoTheme}
window={demoWindow}
>
<DashboardLayout>
<PageContainer>
<Grid container spacing={1}>
<Grid size={5} />
<Grid size={12}>
<Skeleton height={14} />
</Grid>
<Grid size={12}>
<Skeleton height={14} />
</Grid>
<Grid size={4}>
<Skeleton height={100} />
</Grid>
<Grid size={8}>
<Skeleton height={100} />
</Grid>

<Grid size={12}>
<Skeleton height={150} />
</Grid>
<Grid size={12}>
<Skeleton height={14} />
</Grid>

<Grid size={3}>
<Skeleton height={100} />
</Grid>
<Grid size={3}>
<Skeleton height={100} />
</Grid>
<Grid size={3}>
<Skeleton height={100} />
</Grid>
<Grid size={3}>
<Skeleton height={100} />
</Grid>
</Grid>
</PageContainer>
</DashboardLayout>
</AppProvider>
);
}
150 changes: 150 additions & 0 deletions docs/data/material/components/app-bar/DashboardLayoutBasic.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
import * as React from 'react';
import { extendTheme, styled } from '@mui/material/styles';
import DashboardIcon from '@mui/icons-material/Dashboard';
import ShoppingCartIcon from '@mui/icons-material/ShoppingCart';
import BarChartIcon from '@mui/icons-material/BarChart';
import DescriptionIcon from '@mui/icons-material/Description';
import LayersIcon from '@mui/icons-material/Layers';
import { AppProvider, Navigation, Router } from '@toolpad/core/AppProvider';
import { DashboardLayout } from '@toolpad/core/DashboardLayout';
import { PageContainer } from '@toolpad/core/PageContainer';
import Grid from '@mui/material/Grid2';

const NAVIGATION: Navigation = [
{
kind: 'header',
title: 'Main items',
},
{
segment: 'dashboard',
title: 'Dashboard',
icon: <DashboardIcon />,
},
{
segment: 'orders',
title: 'Orders',
icon: <ShoppingCartIcon />,
},
{
kind: 'divider',
},
{
kind: 'header',
title: 'Analytics',
},
{
segment: 'reports',
title: 'Reports',
icon: <BarChartIcon />,
children: [
{
segment: 'sales',
title: 'Sales',
icon: <DescriptionIcon />,
},
{
segment: 'traffic',
title: 'Traffic',
icon: <DescriptionIcon />,
},
],
},
{
segment: 'integrations',
title: 'Integrations',
icon: <LayersIcon />,
},
];

const demoTheme = extendTheme({
colorSchemes: { light: true, dark: true },
colorSchemeSelector: 'class',
breakpoints: {
values: {
xs: 0,
sm: 600,
md: 600,
lg: 1200,
xl: 1536,
},
},
});

function useDemoRouter(initialPath: string): Router {
const [pathname, setPathname] = React.useState(initialPath);

const router = React.useMemo(() => {
return {
pathname,
searchParams: new URLSearchParams(),
navigate: (path: string | URL) => setPathname(String(path)),
};
}, [pathname]);

return router;
}

const Skeleton = styled('div')<{ height: number }>(({ theme, height }) => ({
backgroundColor: theme.palette.action.hover,
borderRadius: theme.shape.borderRadius,
height,
content: '" "',
}));

export default function DashboardLayoutBasic(props: any) {
const { window } = props;

const router = useDemoRouter('/dashboard');

// Remove this const when copying and pasting into your project.
const demoWindow = window !== undefined ? window() : undefined;

return (
<AppProvider
navigation={NAVIGATION}
router={router}
theme={demoTheme}
window={demoWindow}
>
<DashboardLayout>
<PageContainer>
<Grid container spacing={1}>
<Grid size={5} />
<Grid size={12}>
<Skeleton height={14} />
</Grid>
<Grid size={12}>
<Skeleton height={14} />
</Grid>
<Grid size={4}>
<Skeleton height={100} />
</Grid>
<Grid size={8}>
<Skeleton height={100} />
</Grid>

<Grid size={12}>
<Skeleton height={150} />
</Grid>
<Grid size={12}>
<Skeleton height={14} />
</Grid>

<Grid size={3}>
<Skeleton height={100} />
</Grid>
<Grid size={3}>
<Skeleton height={100} />
</Grid>
<Grid size={3}>
<Skeleton height={100} />
</Grid>
<Grid size={3}>
<Skeleton height={100} />
</Grid>
</Grid>
</PageContainer>
</DashboardLayout>
</AppProvider>
);
}
8 changes: 8 additions & 0 deletions docs/data/material/components/app-bar/app-bar.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,3 +152,11 @@ Following the [Material Design guidelines](https://m2.material.io/design/color/d
You can override this behavior by setting the `enableColorOnDark` prop to `true`.

{{"demo": "EnableColorOnDarkAppBar.js", "bg": true}}

## Experimental APIs

### DashboardLayout

The [DashboardLayout](https://mui.com/toolpad/core/react-dashboard-layout/) component from `@toolpad/core` is the starting point for dashboarding applications. It takes care of application layout, theming, navigation, and more. An example usage of this component:

{{"demo": "DashboardLayoutBasic.js", "height": 400, "iframe": true, "hideToolbar": true}}
Loading