-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Expand file tree
/
Copy pathindex.tsx
More file actions
48 lines (45 loc) · 1.26 KB
/
index.tsx
File metadata and controls
48 lines (45 loc) · 1.26 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
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*/
import * as React from 'react';
import cn from 'classnames';
import {lazy, memo, Suspense} from 'react';
const CodeBlock = lazy(() => import('./CodeBlock'));
export default memo(function CodeBlockWrapper(props: {
children: React.ReactNode & {
props: {
className: string;
children: string;
meta?: string;
};
};
isFromPackageImport: boolean;
noMargin?: boolean;
noMarkers?: boolean;
}): any {
const {children, isFromPackageImport} = props;
return (
<Suspense
fallback={
<pre
translate="no"
dir="ltr"
className={cn(
'rounded-lg leading-6 h-full w-full overflow-x-auto flex items-center bg-wash dark:bg-gray-95 shadow-lg text-[13.6px] overflow-hidden',
!isFromPackageImport && 'my-8'
)}>
<div className="py-[18px] ps-5 font-normal">
<p className="sp-pre-placeholder overflow-hidden">{children}</p>
</div>
</pre>
}>
<CodeBlock {...props} />
</Suspense>
);
});