From 1ccd13c59cee197a101d05eb5249bfcbf7d9ffb4 Mon Sep 17 00:00:00 2001 From: Olivier Tassinari Date: Sun, 4 Dec 2022 01:36:25 +0100 Subject: [PATCH 1/2] [core] Fix regression broken ad on Joy --- docs/src/modules/components/MarkdownDocs.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/src/modules/components/MarkdownDocs.js b/docs/src/modules/components/MarkdownDocs.js index 5b2acaa07b991f..f9dc8a199378c4 100644 --- a/docs/src/modules/components/MarkdownDocs.js +++ b/docs/src/modules/components/MarkdownDocs.js @@ -65,9 +65,11 @@ export default function MarkdownDocs(props) { > {disableAd ? null : ( - - - + + + + + )} {isJoy && } {rendered.map((renderedMarkdownOrDemo, index) => { From dfaf3163b77551460ac1a0226fba08245e600810 Mon Sep 17 00:00:00 2001 From: Olivier Tassinari Date: Sun, 4 Dec 2022 01:49:47 +0100 Subject: [PATCH 2/2] alternative solution --- docs/pages/_app.js | 11 +- docs/pages/about.tsx | 27 +- docs/pages/blog.tsx | 399 +++++++++--------- docs/pages/careers.tsx | 29 +- docs/pages/components.tsx | 129 +++--- docs/pages/core.tsx | 41 +- docs/pages/design-kits.tsx | 43 +- docs/pages/index.tsx | 87 ++-- docs/pages/material-ui.tsx | 131 +++--- docs/pages/pricing.tsx | 49 ++- docs/pages/templates.tsx | 41 +- docs/pages/x.tsx | 43 +- docs/src/BrandingCssVarsProvider.tsx | 5 +- docs/src/BrandingProvider.tsx | 25 +- .../components/productCore/CoreHeroEnd.tsx | 7 +- docs/src/components/productX/XComponents.tsx | 8 +- .../components/productX/XDateRangeDemo.tsx | 7 +- .../src/components/productX/XGridFullDemo.tsx | 7 +- docs/src/components/productX/XRoadmap.tsx | 7 +- .../src/components/productX/XTreeViewDemo.tsx | 8 +- docs/src/modules/components/AppFrame.js | 5 - docs/src/modules/components/AppLayoutDocs.js | 61 +-- docs/src/modules/components/Demo.js | 149 +++---- docs/src/modules/components/DemoSandbox.js | 5 +- docs/src/modules/components/MarkdownDocs.js | 58 ++- .../src/modules/components/MarkdownElement.js | 8 +- docs/src/modules/components/ThemeContext.js | 8 +- .../modules/components/TopLayoutCareers.js | 57 +-- 28 files changed, 735 insertions(+), 720 deletions(-) diff --git a/docs/pages/_app.js b/docs/pages/_app.js index a16b6291a22945..ce054d8dc98039 100644 --- a/docs/pages/_app.js +++ b/docs/pages/_app.js @@ -12,7 +12,6 @@ import systemPages from 'docs/data/system/pages'; import PageContext from 'docs/src/modules/components/PageContext'; import GoogleAnalytics from 'docs/src/modules/components/GoogleAnalytics'; import { CodeCopyProvider } from 'docs/src/modules/utils/CodeCopy'; -import { ThemeProvider } from 'docs/src/modules/components/ThemeContext'; import { CodeVariantProvider } from 'docs/src/modules/utils/codeVariant'; import { UserLanguageProvider } from 'docs/src/modules/utils/i18n'; import DocsStyledEngineProvider from 'docs/src/modules/utils/StyledEngineProvider'; @@ -179,12 +178,10 @@ function AppWrapper(props) { - - - {children} - - - + + {children} + + diff --git a/docs/pages/about.tsx b/docs/pages/about.tsx index 645dbde0469b86..e4546cff4bc606 100644 --- a/docs/pages/about.tsx +++ b/docs/pages/about.tsx @@ -25,6 +25,7 @@ import IconImage from 'docs/src/components/icon/IconImage'; import ForumRoundedIcon from '@mui/icons-material/ForumRounded'; import PeopleRoundedIcon from '@mui/icons-material/PeopleRounded'; import LocalAtmRoundedIcon from '@mui/icons-material/LocalAtmRounded'; +import { ThemeProvider } from 'docs/src/modules/components/ThemeContext'; import BrandingCssVarsProvider from 'docs/src/BrandingCssVarsProvider'; import AppHeaderBanner from 'docs/src/components/banner/AppHeaderBanner'; @@ -848,17 +849,19 @@ function AboutContent() { export default function About() { return ( - - - - -
- -
- -
+ + + + + +
+ +
+ +
+
); } diff --git a/docs/pages/blog.tsx b/docs/pages/blog.tsx index 5b0b65ad8c0e12..2697ba91158260 100644 --- a/docs/pages/blog.tsx +++ b/docs/pages/blog.tsx @@ -19,6 +19,7 @@ import Head from 'docs/src/modules/components/Head'; import AppHeader from 'docs/src/layouts/AppHeader'; import AppFooter from 'docs/src/layouts/AppFooter'; import GradientText from 'docs/src/components/typography/GradientText'; +import { ThemeProvider } from 'docs/src/modules/components/ThemeContext'; import BrandingCssVarsProvider from 'docs/src/BrandingCssVarsProvider'; import { authors as AUTHORS } from 'docs/src/modules/components/TopLayoutBlog'; import HeroEnd from 'docs/src/components/home/HeroEnd'; @@ -246,209 +247,219 @@ export default function Blog(props: InferGetStaticPropsType - - -
-
- - Blog - - - The latest about MUI - - + + + +
+
- {[firstPost, secondPost].map((post) => ( - - theme.applyDarkStyles({ - '&:hover, &:focus-within': { - borderColor: 'primary.600', - boxShadow: '0px 4px 20px rgba(0, 0, 0, 0.5)', - }, - }), - ]} - > - {post.image && ( - - )} - - - ))} - -
- - - Posts{' '} - {Object.keys(selectedTags).length ? ( - - tagged as{' '} - - "{Object.keys(selectedTags)[0]}" - - - ) : ( - '' - )} - - + + Blog + + + The latest about MUI + ({ - position: 'sticky', - top: 100, - alignSelf: 'start', - mb: 2, - mt: { xs: 3, sm: 2, md: 9 }, // margin-top makes the title appear when scroll into view - p: 2, - borderRadius: 1, - border: '1px solid', - background: 'rgba(255, 255, 255, 0.2)', - borderColor: (theme.vars || theme).palette.grey[200], - ...theme.applyDarkStyles({ - background: alpha(theme.palette.primaryDark[700], 0.2), - borderColor: (theme.vars || theme).palette.primaryDark[700], - }), - })} + component="ul" + sx={{ + display: 'grid', + m: 0, + p: 0, + gap: 2, + gridTemplateColumns: 'repeat(auto-fit, minmax(300px, 1fr))', + }} > - - Filter by tag - - - {Object.keys(tagInfo).map((tag) => { - const selected = !!selectedTags[tag]; - return ( - { - postListRef.current?.scrollIntoView(); - removeTag(tag); - }, - } - : { - label: tag, - onClick: () => { - postListRef.current?.scrollIntoView(); - router.push( - { - query: { - ...router.query, - tags: tag, - }, - }, - undefined, - { shallow: true }, - ); - }, - })} - size="small" + {[firstPost, secondPost].map((post) => ( + + theme.applyDarkStyles({ + '&:hover, &:focus-within': { + borderColor: 'primary.600', + boxShadow: '0px 4px 20px rgba(0, 0, 0, 0.5)', + }, + }), + ]} + > + {post.image && ( + - ); - })} - + )} + + + ))} - - - - {displayedPosts.map((post) => ( - ({ - py: 2.5, - display: 'flex', - flexDirection: 'column', - position: 'relative', - '&:not(:last-of-type)': { - borderBottom: '1px solid', - borderColor: 'divider', - }, +
+ + + Posts{' '} + {Object.keys(selectedTags).length ? ( + + tagged as{' '} + + "{Object.keys(selectedTags)[0]}" + + + ) : ( + '' + )} + + + ({ + position: 'sticky', + top: 100, + alignSelf: 'start', + mb: 2, + mt: { xs: 3, sm: 2, md: 9 }, // margin-top makes the title appear when scroll into view + p: 2, + borderRadius: 1, + border: '1px solid', + background: 'rgba(255, 255, 255, 0.2)', + borderColor: (theme.vars || theme).palette.grey[200], + ...theme.applyDarkStyles({ + background: alpha(theme.palette.primaryDark[700], 0.2), + borderColor: (theme.vars || theme).palette.primaryDark[700], + }), + })} + > + + Filter by tag + + + {Object.keys(tagInfo).map((tag) => { + const selected = !!selectedTags[tag]; + return ( + { + postListRef.current?.scrollIntoView(); + removeTag(tag); + }, + } + : { + label: tag, + onClick: () => { + postListRef.current?.scrollIntoView(); + router.push( + { + query: { + ...router.query, + tags: tag, + }, + }, + undefined, + { shallow: true }, + ); + }, + })} + size="small" + sx={{ + py: 1.2, + }} + /> + ); })} - > - - ))} + - { - setPage(value - 1); - postListRef.current?.scrollIntoView(); - }} - sx={{ mt: 1, mb: 8 }} - /> - - -
- - - - + + + {displayedPosts.map((post) => ( + ({ + py: 2.5, + display: 'flex', + flexDirection: 'column', + position: 'relative', + '&:not(:last-of-type)': { + borderBottom: '1px solid', + borderColor: 'divider', + }, + })} + > + + + ))} + + { + setPage(value - 1); + postListRef.current?.scrollIntoView(); + }} + sx={{ mt: 1, mb: 8 }} + /> + + + + + + + + ); } diff --git a/docs/pages/careers.tsx b/docs/pages/careers.tsx index fe55bcd22575f8..a8d15cb7fb7744 100644 --- a/docs/pages/careers.tsx +++ b/docs/pages/careers.tsx @@ -17,6 +17,7 @@ import AppFooter from 'docs/src/layouts/AppFooter'; import MuiStatistics from 'docs/src/components/home/MuiStatistics'; import GradientText from 'docs/src/components/typography/GradientText'; import IconImage from 'docs/src/components/icon/IconImage'; +import { ThemeProvider } from 'docs/src/modules/components/ThemeContext'; import BrandingCssVarsProvider from 'docs/src/BrandingCssVarsProvider'; import MuiAccordion from '@mui/material/Accordion'; import MuiAccordionSummary from '@mui/material/AccordionSummary'; @@ -591,18 +592,20 @@ function CareersContent() { export default function Careers() { return ( - - - - -
- -
- - -
+ + + + + +
+ +
+ + +
+
); } diff --git a/docs/pages/components.tsx b/docs/pages/components.tsx index 3e9045ae057a6a..9f9422acd7062a 100644 --- a/docs/pages/components.tsx +++ b/docs/pages/components.tsx @@ -9,7 +9,8 @@ import Divider from '@mui/material/Divider'; import KeyboardArrowRightRounded from '@mui/icons-material/KeyboardArrowRightRounded'; import AppHeader from 'docs/src/layouts/AppHeader'; import AppFooter from 'docs/src/layouts/AppFooter'; -import BrandingProvider from 'docs/src/BrandingProvider'; +import { ThemeProvider } from 'docs/src/modules/components/ThemeContext'; +import BrandingCssVarsProvider from 'docs/src/BrandingCssVarsProvider'; import Section from 'docs/src/layouts/Section'; import PageContext from 'docs/src/modules/components/PageContext'; import { pageToTitleI18n } from 'docs/src/modules/utils/helpers'; @@ -50,67 +51,69 @@ export default function Components() { ); } return ( - - - -
-
- - All Components - - - {(componentPageData?.children || []).map((page) => ( - - - {pageToTitleI18n(page, t)} - - - {(page.children || []).map((nestedPage) => { - if (nestedPage.children) { - return ( - - - - {pageToTitleI18n(nestedPage, t) || ''} - - {nestedPage.children.map(renderItem)} - - - ); - } - return renderItem(nestedPage); - })} - - - ))} - -
-
- - -
+ + + + +
+
+ + All Components + + + {(componentPageData?.children || []).map((page) => ( + + + {pageToTitleI18n(page, t)} + + + {(page.children || []).map((nestedPage) => { + if (nestedPage.children) { + return ( + + + + {pageToTitleI18n(nestedPage, t) || ''} + + {nestedPage.children.map(renderItem)} + + + ); + } + return renderItem(nestedPage); + })} + + + ))} + +
+
+ + +
+
); } diff --git a/docs/pages/core.tsx b/docs/pages/core.tsx index 5948f0dbaef11a..0c8d309ff944dc 100644 --- a/docs/pages/core.tsx +++ b/docs/pages/core.tsx @@ -1,6 +1,7 @@ import * as React from 'react'; import Head from 'docs/src/modules/components/Head'; -import BrandingProvider from 'docs/src/BrandingProvider'; +import { ThemeProvider } from 'docs/src/modules/components/ThemeContext'; +import BrandingCssVarsProvider from 'docs/src/BrandingCssVarsProvider'; import AppHeader from 'docs/src/layouts/AppHeader'; import CoreHero from 'docs/src/components/productCore/CoreHero'; import CoreComponents from 'docs/src/components/productCore/CoreComponents'; @@ -13,23 +14,25 @@ import AppHeaderBanner from 'docs/src/components/banner/AppHeaderBanner'; export default function Core() { return ( - - - - -
- - - - - - -
- -
+ + + + + +
+ + + + + + +
+ +
+
); } diff --git a/docs/pages/design-kits.tsx b/docs/pages/design-kits.tsx index 6931105d34d36b..bf505bdf52b6df 100644 --- a/docs/pages/design-kits.tsx +++ b/docs/pages/design-kits.tsx @@ -9,31 +9,34 @@ import DesignKitDemo from 'docs/src/components/productDesignKit/DesignKitDemo'; import DesignKitFAQ from 'docs/src/components/productDesignKit/DesignKitFAQ'; import Testimonials from 'docs/src/components/home/Testimonials'; import HeroEnd from 'docs/src/components/home/HeroEnd'; +import { ThemeProvider } from 'docs/src/modules/components/ThemeContext'; import BrandingCssVarsProvider from 'docs/src/BrandingCssVarsProvider'; import References, { DESIGNKITS_CUSTOMERS } from 'docs/src/components/home/References'; import AppHeaderBanner from 'docs/src/components/banner/AppHeaderBanner'; export default function DesignKits() { return ( - - - - -
- - - - - - - -
- - -
+ + + + + +
+ + + + + + + +
+ + +
+
); } diff --git a/docs/pages/index.tsx b/docs/pages/index.tsx index 498cffac6346ec..45bc3cef980f25 100644 --- a/docs/pages/index.tsx +++ b/docs/pages/index.tsx @@ -12,53 +12,56 @@ import Testimonials from 'docs/src/components/home/Testimonials'; import Sponsors from 'docs/src/components/home/Sponsors'; import HeroEnd from 'docs/src/components/home/HeroEnd'; import AppFooter from 'docs/src/layouts/AppFooter'; +import { ThemeProvider } from 'docs/src/modules/components/ThemeContext'; import BrandingCssVarsProvider from 'docs/src/BrandingCssVarsProvider'; import NewsletterToast from 'docs/src/components/home/NewsletterToast'; import AppHeaderBanner from 'docs/src/components/banner/AppHeaderBanner'; export default function Home() { return ( - - -