From aa8a72cd12c2105db9c6f05c97b09f494a56cf79 Mon Sep 17 00:00:00 2001 From: Pedro Ferreira <10789765+apedroferreira@users.noreply.github.com> Date: Tue, 26 Nov 2024 19:40:54 +0000 Subject: [PATCH 01/11] Allow full-size content in PageContainer --- .../page-container/ActionsPageContainer.js | 6 +- .../page-container/ActionsPageContainer.tsx | 6 +- .../ActionsPageContainer.tsx.preview | 4 +- .../page-container/PageContainerFullScreen.js | 72 +++++++++ .../PageContainerFullScreen.tsx | 69 +++++++++ .../PageContainerFullScreen.tsx.preview | 11 ++ .../page-container/PageContainerHeader.js | 34 +++++ .../page-container/PageContainerHeader.tsx | 34 +++++ .../PageContainerHeader.tsx.preview | 8 + .../page-container/page-container.md | 16 +- docs/data/toolpad/core/pagesApi.js | 3 +- .../core/api/account-popover-footer.json | 10 +- .../core/api/account-popover-header.json | 2 +- .../core/api/page-container-toolbar.json | 13 -- .../toolpad/core/api/page-container.json | 9 +- ...iner-toolbar.js => page-header-toolbar.js} | 6 +- .../toolpad/core/api/page-header-toolbar.json | 13 ++ docs/pages/toolpad/core/api/page-header.js | 23 +++ docs/pages/toolpad/core/api/page-header.json | 21 +++ .../toolpad/core/api/sign-in-button.json | 2 +- .../toolpad/core/api/sign-out-button.json | 2 +- .../account-popover-footer.json | 10 +- .../account-popover-header.json | 6 +- .../page-container/page-container.json | 3 + .../page-header-toolbar.json} | 0 .../api-docs/page-header/page-header.json | 12 ++ .../sign-in-button/sign-in-button.json | 2 +- .../sign-out-button/sign-out-button.json | 2 +- packages/toolpad-core/package.json | 2 + .../src/Account/AccountPopoverFooter.tsx | 24 ++- .../src/Account/AccountPopoverHeader.tsx | 16 +- .../toolpad-core/src/Account/SignInButton.tsx | 16 +- .../src/Account/SignOutButton.tsx | 16 +- .../src/AppProvider/AppThemeProvider.tsx | 49 ++++++ .../DashboardSidebarSubNavigation.tsx | 70 +++++++++ .../src/DashboardLayout/ToolpadLogo.tsx | 13 +- .../src/PageContainer/PageContainer.test.tsx | 23 --- .../src/PageContainer/PageContainer.tsx | 142 ++++++------------ .../PageContainer/PageContainerToolbar.tsx | 31 ---- .../src/PageContainer/PageHeader.tsx | 135 +++++++++++++++++ ...ar.test.tsx => PageHeaderToolbar.test.tsx} | 6 +- .../src/PageContainer/PageHeaderToolbar.tsx | 43 ++++++ .../toolpad-core/src/PageContainer/index.ts | 3 +- pnpm-lock.yaml | 120 ++++++++++++++- scripts/generateProptypes.ts | 2 +- 45 files changed, 905 insertions(+), 205 deletions(-) create mode 100644 docs/data/toolpad/core/components/page-container/PageContainerFullScreen.js create mode 100644 docs/data/toolpad/core/components/page-container/PageContainerFullScreen.tsx create mode 100644 docs/data/toolpad/core/components/page-container/PageContainerFullScreen.tsx.preview create mode 100644 docs/data/toolpad/core/components/page-container/PageContainerHeader.js create mode 100644 docs/data/toolpad/core/components/page-container/PageContainerHeader.tsx create mode 100644 docs/data/toolpad/core/components/page-container/PageContainerHeader.tsx.preview delete mode 100644 docs/pages/toolpad/core/api/page-container-toolbar.json rename docs/pages/toolpad/core/api/{page-container-toolbar.js => page-header-toolbar.js} (76%) create mode 100644 docs/pages/toolpad/core/api/page-header-toolbar.json create mode 100644 docs/pages/toolpad/core/api/page-header.js create mode 100644 docs/pages/toolpad/core/api/page-header.json rename docs/translations/api-docs/{page-container-toolbar/page-container-toolbar.json => page-header-toolbar/page-header-toolbar.json} (100%) create mode 100644 docs/translations/api-docs/page-header/page-header.json delete mode 100644 packages/toolpad-core/src/PageContainer/PageContainerToolbar.tsx create mode 100644 packages/toolpad-core/src/PageContainer/PageHeader.tsx rename packages/toolpad-core/src/PageContainer/{PageContainerToolbar.test.tsx => PageHeaderToolbar.test.tsx} (61%) create mode 100644 packages/toolpad-core/src/PageContainer/PageHeaderToolbar.tsx diff --git a/docs/data/toolpad/core/components/page-container/ActionsPageContainer.js b/docs/data/toolpad/core/components/page-container/ActionsPageContainer.js index db7bf0f7bfa..3924adf43f7 100644 --- a/docs/data/toolpad/core/components/page-container/ActionsPageContainer.js +++ b/docs/data/toolpad/core/components/page-container/ActionsPageContainer.js @@ -1,6 +1,6 @@ import * as React from 'react'; import { useDemoRouter } from '@toolpad/core/internal'; -import { PageContainer, PageContainerToolbar } from '@toolpad/core/PageContainer'; +import { PageContainer, PageHeaderToolbar } from '@toolpad/core/PageContainer'; import { AppProvider } from '@toolpad/core/AppProvider'; import { LocalizationProvider } from '@mui/x-date-pickers-pro/LocalizationProvider'; import { AdapterDayjs } from '@mui/x-date-pickers-pro/AdapterDayjs'; @@ -21,7 +21,7 @@ const NAVIGATION = [ // preview-start function PageToolbar() { return ( - + @@ -32,7 +32,7 @@ function PageToolbar() { slotProps={{ field: { size: 'small' } }} label="Period" /> - + ); } // preview-end diff --git a/docs/data/toolpad/core/components/page-container/ActionsPageContainer.tsx b/docs/data/toolpad/core/components/page-container/ActionsPageContainer.tsx index c36edc6b872..37869bfd9fc 100644 --- a/docs/data/toolpad/core/components/page-container/ActionsPageContainer.tsx +++ b/docs/data/toolpad/core/components/page-container/ActionsPageContainer.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; import { useDemoRouter } from '@toolpad/core/internal'; -import { PageContainer, PageContainerToolbar } from '@toolpad/core/PageContainer'; +import { PageContainer, PageHeaderToolbar } from '@toolpad/core/PageContainer'; import { AppProvider } from '@toolpad/core/AppProvider'; import { LocalizationProvider } from '@mui/x-date-pickers-pro/LocalizationProvider'; import { AdapterDayjs } from '@mui/x-date-pickers-pro/AdapterDayjs'; @@ -21,7 +21,7 @@ const NAVIGATION = [ // preview-start function PageToolbar() { return ( - + @@ -32,7 +32,7 @@ function PageToolbar() { slotProps={{ field: { size: 'small' } as any }} label="Period" /> - + ); } // preview-end diff --git a/docs/data/toolpad/core/components/page-container/ActionsPageContainer.tsx.preview b/docs/data/toolpad/core/components/page-container/ActionsPageContainer.tsx.preview index 99d697f9bbb..5fbcc68c340 100644 --- a/docs/data/toolpad/core/components/page-container/ActionsPageContainer.tsx.preview +++ b/docs/data/toolpad/core/components/page-container/ActionsPageContainer.tsx.preview @@ -1,6 +1,6 @@ function PageToolbar() { return ( - + @@ -11,6 +11,6 @@ function PageToolbar() { slotProps={{ field: { size: 'small' } as any }} label="Period" /> - + ); } \ No newline at end of file diff --git a/docs/data/toolpad/core/components/page-container/PageContainerFullScreen.js b/docs/data/toolpad/core/components/page-container/PageContainerFullScreen.js new file mode 100644 index 00000000000..43d867e76ce --- /dev/null +++ b/docs/data/toolpad/core/components/page-container/PageContainerFullScreen.js @@ -0,0 +1,72 @@ +import * as React from 'react'; +import PropTypes from 'prop-types'; +import { createTheme } from '@mui/material/styles'; +import MapIcon from '@mui/icons-material/Map'; +import { AppProvider } from '@toolpad/core/AppProvider'; +import { DashboardLayout } from '@toolpad/core/DashboardLayout'; +import { PageContainer } from '@toolpad/core/PageContainer'; +import { useDemoRouter } from '@toolpad/core/internal'; + +const NAVIGATION = [ + { + segment: 'map', + title: 'Map', + icon: , + }, +]; + +const demoTheme = createTheme({ + cssVariables: { + colorSchemeSelector: 'data-toolpad-color-scheme', + }, + colorSchemes: { light: true, dark: true }, + breakpoints: { + values: { + xs: 0, + sm: 600, + md: 600, + lg: 1200, + xl: 1536, + }, + }, +}); + +function PageContainerFullScreen(props) { + const { window } = props; + + const router = useDemoRouter('/map'); + + // Remove this const when copying and pasting into your project. + const demoWindow = window !== undefined ? window() : undefined; + + return ( + + + +