diff --git a/docs/app/bench/docs-infra/components/code-highlighter/demos/CodeContentLoading.tsx b/docs/app/bench/docs-infra/components/code-highlighter/demos/CodeContentLoading.tsx index 3c62f1d2a..da554295d 100644 --- a/docs/app/bench/docs-infra/components/code-highlighter/demos/CodeContentLoading.tsx +++ b/docs/app/bench/docs-infra/components/code-highlighter/demos/CodeContentLoading.tsx @@ -6,12 +6,12 @@ import styles from './CodeContent.module.css'; import '../../../../../docs-infra/components/code-highlighter/demos/syntax.css'; -export function CodeContentLoading(props: ContentLoadingProps<{}>) { +export function CodeContentLoading(_props: ContentLoadingProps<{}>) { return (
{/* @focus-start */}
-
{props.source}
+
       
{/* @focus-end */}
diff --git a/docs/app/docs-infra/components/code-highlighter/demos/demo-fallback-all-files/DemoContentLoading.tsx b/docs/app/docs-infra/components/code-highlighter/demos/demo-fallback-all-files/DemoContentLoading.tsx index e6e9f12a0..b0f78e952 100644 --- a/docs/app/docs-infra/components/code-highlighter/demos/demo-fallback-all-files/DemoContentLoading.tsx +++ b/docs/app/docs-infra/components/code-highlighter/demos/demo-fallback-all-files/DemoContentLoading.tsx @@ -2,6 +2,8 @@ import * as React from 'react'; import type { ContentLoadingProps } from '@mui/internal-docs-infra/CodeHighlighter/types'; +import { useCodeFallback } from '@mui/internal-docs-infra/CodeHighlighter'; +import { hastToJsx } from '@mui/internal-docs-infra/pipeline/hastUtils'; import { Tabs } from '@/components/Tabs'; import styles from '../DemoContent.module.css'; import loadingStyles from './DemoContentLoading.module.css'; @@ -10,6 +12,7 @@ import '../syntax.css'; export function DemoContentLoading(props: ContentLoadingProps) { // @focus-start + const { source, extraSource } = useCodeFallback(props); const tabs = React.useMemo( () => props.fileNames?.map((name) => ({ @@ -47,11 +50,11 @@ export function DemoContentLoading(props: ContentLoadingProps) {
-
{props.source}
+
{source ? hastToJsx(source) : null}
- {Object.keys(props.extraSource || {}).map((slug) => ( -
{props.extraSource?.[slug]}
+ {Object.keys(extraSource || {}).map((slug) => ( +
{extraSource?.[slug] ? hastToJsx(extraSource[slug]) : null}
))}
diff --git a/docs/app/docs-infra/components/code-highlighter/demos/demo-fallback-all-variants/DemoContentLoading.tsx b/docs/app/docs-infra/components/code-highlighter/demos/demo-fallback-all-variants/DemoContentLoading.tsx index 42212fdf2..b027a33e8 100644 --- a/docs/app/docs-infra/components/code-highlighter/demos/demo-fallback-all-variants/DemoContentLoading.tsx +++ b/docs/app/docs-infra/components/code-highlighter/demos/demo-fallback-all-variants/DemoContentLoading.tsx @@ -2,6 +2,8 @@ import * as React from 'react'; import type { ContentLoadingProps } from '@mui/internal-docs-infra/CodeHighlighter/types'; +import { useCodeFallback } from '@mui/internal-docs-infra/CodeHighlighter'; +import { hastToJsx } from '@mui/internal-docs-infra/pipeline/hastUtils'; import { Tabs } from '@/components/Tabs'; import { Select } from '@/components/Select'; import styles from '../DemoContent.module.css'; @@ -15,6 +17,7 @@ const variantNames: Record = { export function DemoContentLoading(props: ContentLoadingProps) { // @focus-start + const { source, extraSource, extraVariants } = useCodeFallback(props); const tabs = React.useMemo( () => props.fileNames?.map((name) => ({ @@ -39,7 +42,7 @@ export function DemoContentLoading(props: ContentLoadingProps) { return (
- {Object.keys(props.extraSource || {}).map((slug) => ( + {Object.keys(extraSource || {}).map((slug) => ( ))}
@@ -58,28 +61,31 @@ export function DemoContentLoading(props: ContentLoadingProps) { )}
- {Object.keys(props.extraVariants || {}).length >= 1 && ( + {Object.keys(extraVariants || {}).length >= 1 && (