Skip to content

Commit

Permalink
[core] Make DashboardLayout navigation responsive (mui#3750)
Browse files Browse the repository at this point in the history
  • Loading branch information
apedroferreira authored Jul 19, 2024
1 parent 98b87ad commit aef3803
Show file tree
Hide file tree
Showing 23 changed files with 389 additions and 66 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as React from 'react';
import PropTypes from 'prop-types';
import Box from '@mui/material/Box';
import Typography from '@mui/material/Typography';
import { extendTheme } from '@mui/material/styles';
import DashboardIcon from '@mui/icons-material/Dashboard';
import TimelineIcon from '@mui/icons-material/Timeline';
import { AppProvider } from '@toolpad/core/AppProvider';
Expand All @@ -24,6 +25,18 @@ const NAVIGATION = [
},
];

const demoTheme = extendTheme({
breakpoints: {
values: {
xs: 0,
sm: 600,
md: 600,
lg: 1200,
xl: 1536,
},
},
});

function DemoPageContent({ pathname }) {
return (
<Box
Expand Down Expand Up @@ -62,7 +75,12 @@ function AppProviderBasic(props) {

return (
// preview-start
<AppProvider navigation={NAVIGATION} router={router} window={demoWindow}>
<AppProvider
navigation={NAVIGATION}
router={router}
theme={demoTheme}
window={demoWindow}
>
<DashboardLayout>
<DemoPageContent pathname={pathname} />
</DashboardLayout>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as React from 'react';
import Box from '@mui/material/Box';
import Typography from '@mui/material/Typography';
import { extendTheme } from '@mui/material/styles';
import DashboardIcon from '@mui/icons-material/Dashboard';
import TimelineIcon from '@mui/icons-material/Timeline';
import { AppProvider } from '@toolpad/core/AppProvider';
Expand All @@ -24,6 +25,18 @@ const NAVIGATION: Navigation = [
},
];

const demoTheme = extendTheme({
breakpoints: {
values: {
xs: 0,
sm: 600,
md: 600,
lg: 1200,
xl: 1536,
},
},
});

function DemoPageContent({ pathname }: { pathname: string }) {
return (
<Box
Expand Down Expand Up @@ -66,7 +79,12 @@ export default function AppProviderBasic(props: DemoProps) {

return (
// preview-start
<AppProvider navigation={NAVIGATION} router={router} window={demoWindow}>
<AppProvider
navigation={NAVIGATION}
router={router}
theme={demoTheme}
window={demoWindow}
>
<DashboardLayout>
<DemoPageContent pathname={pathname} />
</DashboardLayout>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
<AppProvider navigation={NAVIGATION} router={router} window={demoWindow}>
<AppProvider
navigation={NAVIGATION}
router={router}
theme={demoTheme}
window={demoWindow}
>
<DashboardLayout>
<DemoPageContent pathname={pathname} />
</DashboardLayout>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@ const customTheme = extendTheme({
},
},
},
breakpoints: {
values: {
xs: 0,
sm: 600,
md: 600,
lg: 1200,
xl: 1536,
},
},
});

function DemoPageContent({ pathname }) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@ const customTheme = extendTheme({
},
},
},
breakpoints: {
values: {
xs: 0,
sm: 600,
md: 600,
lg: 1200,
xl: 1536,
},
},
});

function DemoPageContent({ pathname }: { pathname: string }) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as React from 'react';
import PropTypes from 'prop-types';
import Box from '@mui/material/Box';
import Typography from '@mui/material/Typography';
import { extendTheme } 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';
Expand Down Expand Up @@ -56,6 +57,18 @@ const NAVIGATION = [
},
];

const demoTheme = extendTheme({
breakpoints: {
values: {
xs: 0,
sm: 600,
md: 600,
lg: 1200,
xl: 1536,
},
},
});

function DemoPageContent({ pathname }) {
return (
<Box
Expand Down Expand Up @@ -94,7 +107,12 @@ function DashboardLayoutBasic(props) {

return (
// preview-start
<AppProvider navigation={NAVIGATION} router={router} window={demoWindow}>
<AppProvider
navigation={NAVIGATION}
router={router}
theme={demoTheme}
window={demoWindow}
>
<DashboardLayout>
<DemoPageContent pathname={pathname} />
</DashboardLayout>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as React from 'react';
import Box from '@mui/material/Box';
import Typography from '@mui/material/Typography';
import { extendTheme } 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';
Expand Down Expand Up @@ -56,6 +57,18 @@ const NAVIGATION: Navigation = [
},
];

const demoTheme = extendTheme({
breakpoints: {
values: {
xs: 0,
sm: 600,
md: 600,
lg: 1200,
xl: 1536,
},
},
});

function DemoPageContent({ pathname }: { pathname: string }) {
return (
<Box
Expand Down Expand Up @@ -98,7 +111,12 @@ export default function DashboardLayoutBasic(props: DemoProps) {

return (
// preview-start
<AppProvider navigation={NAVIGATION} router={router} window={demoWindow}>
<AppProvider
navigation={NAVIGATION}
router={router}
theme={demoTheme}
window={demoWindow}
>
<DashboardLayout>
<DemoPageContent pathname={pathname} />
</DashboardLayout>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
<AppProvider navigation={NAVIGATION} router={router} window={demoWindow}>
<AppProvider
navigation={NAVIGATION}
router={router}
theme={demoTheme}
window={demoWindow}
>
<DashboardLayout>
<DemoPageContent pathname={pathname} />
</DashboardLayout>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as React from 'react';
import PropTypes from 'prop-types';
import Box from '@mui/material/Box';
import Typography from '@mui/material/Typography';
import { extendTheme } from '@mui/material/styles';
import DashboardIcon from '@mui/icons-material/Dashboard';
import ShoppingCartIcon from '@mui/icons-material/ShoppingCart';
import { AppProvider } from '@toolpad/core/AppProvider';
Expand All @@ -20,6 +21,18 @@ const NAVIGATION = [
},
];

const demoTheme = extendTheme({
breakpoints: {
values: {
xs: 0,
sm: 600,
md: 600,
lg: 1200,
xl: 1536,
},
},
});

function DemoPageContent({ pathname }) {
return (
<Box
Expand Down Expand Up @@ -65,6 +78,7 @@ function DashboardLayoutBranding(props) {
title: 'MUI',
}}
router={router}
theme={demoTheme}
window={demoWindow}
>
<DashboardLayout>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as React from 'react';
import Box from '@mui/material/Box';
import Typography from '@mui/material/Typography';
import { extendTheme } from '@mui/material/styles';
import DashboardIcon from '@mui/icons-material/Dashboard';
import ShoppingCartIcon from '@mui/icons-material/ShoppingCart';
import { AppProvider, Router } from '@toolpad/core/AppProvider';
Expand All @@ -20,6 +21,18 @@ const NAVIGATION: Navigation = [
},
];

const demoTheme = extendTheme({
breakpoints: {
values: {
xs: 0,
sm: 600,
md: 600,
lg: 1200,
xl: 1536,
},
},
});

function DemoPageContent({ pathname }: { pathname: string }) {
return (
<Box
Expand Down Expand Up @@ -69,6 +82,7 @@ export default function DashboardLayoutBranding(props: DemoProps) {
title: 'MUI',
}}
router={router}
theme={demoTheme}
window={demoWindow}
>
<DashboardLayout>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
title: 'MUI',
}}
router={router}
theme={demoTheme}
window={demoWindow}
>
<DashboardLayout>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,24 @@ import * as React from 'react';
import PropTypes from 'prop-types';
import Box from '@mui/material/Box';
import Typography from '@mui/material/Typography';
import { extendTheme } from '@mui/material/styles';
import DescriptionIcon from '@mui/icons-material/Description';
import FolderIcon from '@mui/icons-material/Folder';
import { AppProvider } from '@toolpad/core/AppProvider';
import { DashboardLayout } from '@toolpad/core/DashboardLayout';

const demoTheme = extendTheme({
breakpoints: {
values: {
xs: 0,
sm: 600,
md: 600,
lg: 1200,
xl: 1536,
},
},
});

function DemoPageContent({ pathname }) {
return (
<Box
Expand Down Expand Up @@ -187,6 +200,7 @@ function DashboardLayoutNavigation(props) {
},
]}
router={router}
theme={demoTheme}
window={demoWindow}
>
<DashboardLayout>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
import * as React from 'react';
import Box from '@mui/material/Box';
import Typography from '@mui/material/Typography';
import { extendTheme } from '@mui/material/styles';
import DescriptionIcon from '@mui/icons-material/Description';
import FolderIcon from '@mui/icons-material/Folder';
import { AppProvider, Router } from '@toolpad/core/AppProvider';
import { DashboardLayout } from '@toolpad/core/DashboardLayout';

const demoTheme = extendTheme({
breakpoints: {
values: {
xs: 0,
sm: 600,
md: 600,
lg: 1200,
xl: 1536,
},
},
});

function DemoPageContent({ pathname }: { pathname: string }) {
return (
<Box
Expand Down Expand Up @@ -190,6 +203,7 @@ export default function DashboardLayoutNavigation(props: DemoProps) {
},
]}
router={router}
theme={demoTheme}
window={demoWindow}
>
<DashboardLayout>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@
},
]}
router={router}
theme={demoTheme}
window={demoWindow}
>
<DashboardLayout>
Expand Down
Loading

0 comments on commit aef3803

Please sign in to comment.