From 8dfd253ed51df1523f6af4e22da73c42d330b385 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Dudak?= Date: Fri, 19 Apr 2024 22:03:42 +0200 Subject: [PATCH] [docs-infra] Adapt docs infra to Base UI docs needs (#41963) --- docs/src/modules/components/ApiPage.js | 4 +++- docs/src/modules/components/ComponentsApiContent.js | 4 +++- docs/src/modules/components/HooksApiContent.js | 4 +++- docs/src/modules/sandbox/Dependencies.ts | 11 ++++++----- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/docs/src/modules/components/ApiPage.js b/docs/src/modules/components/ApiPage.js index 9d9ff276d444a6..0ad1c5a26eeceb 100644 --- a/docs/src/modules/components/ApiPage.js +++ b/docs/src/modules/components/ApiPage.js @@ -249,7 +249,9 @@ export default function ApiPage(props) { `)} language="jsx" /> -

+ {pageContent.imports.length > 1 && ( +

+ )} {componentDescription ? (
diff --git a/docs/src/modules/components/ComponentsApiContent.js b/docs/src/modules/components/ComponentsApiContent.js index 59d7e53c6073f6..39249a9877b5ad 100644 --- a/docs/src/modules/components/ComponentsApiContent.js +++ b/docs/src/modules/components/ComponentsApiContent.js @@ -150,7 +150,9 @@ export default function ComponentsApiContent(props) { -

+ {imports.length > 1 && ( +

+ )} -

+ {imports.length > 1 && ( +

+ )} {Object.keys(parameters).length > 0 ? ( ): void { const packagesWithDTPackage = Object.keys(deps) .filter((name) => packagesWithBundledTypes.indexOf(name) === -1) // All the MUI packages come with bundled types - .filter((name) => name.indexOf('@mui/') !== 0); + .filter((name) => !muiNpmOrgs.some((org) => name.startsWith(org))); packagesWithDTPackage.forEach((name) => { let resolvedName = name; @@ -79,7 +80,7 @@ export default function SandboxDependencies( } // TODO: consider if this configuration could be injected in a "cleaner" way. - if (muiDocConfig) { + if (muiDocConfig && muiDocConfig.csbIncludePeerDependencies) { newDeps = muiDocConfig.csbIncludePeerDependencies(newDeps, { versions, }); @@ -108,7 +109,7 @@ export default function SandboxDependencies( }; // TODO: consider if this configuration could be injected in a "cleaner" way. - if (muiDocConfig) { + if (muiDocConfig && muiDocConfig.csbGetVersions) { versions = muiDocConfig.csbGetVersions(versions, { muiCommitRef: commitRef }); } @@ -125,8 +126,8 @@ export default function SandboxDependencies( deps[name] = versions[name] ?? 'latest'; } - if (muiDocConfig) { - const resolvedDep = muiDocConfig?.postProcessImport(fullName); + if (muiDocConfig && muiDocConfig.postProcessImport) { + const resolvedDep = muiDocConfig.postProcessImport(fullName); if (resolvedDep) { deps = { ...deps, ...resolvedDep }; }