-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathDemoPerformanceContentLoading.tsx
More file actions
54 lines (49 loc) · 1.56 KB
/
DemoPerformanceContentLoading.tsx
File metadata and controls
54 lines (49 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
'use client';
import * as React from 'react';
import type { ContentLoadingProps } from '@mui/internal-docs-infra/CodeHighlighter/types';
import { Tabs } from '@/components/Tabs';
import styles from '../../app/docs-infra/components/code-highlighter/demos/DemoContent.module.css';
import '@wooorm/starry-night/style/light';
export function DemoPerformanceContentLoading(props: ContentLoadingProps<object>) {
const tabs = React.useMemo(
() =>
props.fileNames?.map((name) => ({
id: name || '',
name: name || '',
slug: name,
})),
[props.fileNames],
);
const onTabSelect = React.useCallback(() => {
// No-op
}, []);
return (
<div>
{Object.keys(props.extraSource || {}).map((fileName) => (
<span key={fileName} className={styles.fileRefs} />
))}
<div className={styles.container}>
<div className={styles.demoSection}></div>
<div className={styles.codeSection}>
<div className={styles.header}>
<div className={styles.headerContainer}>
{tabs && (
<div className={styles.tabContainer}>
<Tabs
tabs={tabs}
selectedTabId={props.fileNames?.[0]}
onTabSelect={onTabSelect}
disabled={true}
/>
</div>
)}
</div>
</div>
<div className={styles.code}>
<pre className={styles.codeBlock}>{props.source}</pre>
</div>
</div>
</div>
</div>
);
}