-
-
Notifications
You must be signed in to change notification settings - Fork 95
Expand file tree
/
Copy pathLazyCodeEditorContainer.tsx
More file actions
31 lines (26 loc) · 773 Bytes
/
LazyCodeEditorContainer.tsx
File metadata and controls
31 lines (26 loc) · 773 Bytes
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
import React from 'react'
import { Spinner, SpinnerSize } from '@fluentui/react'
import { FlexContainer } from '../FlexContainer'
const styles = {
flex: '1 1 0%',
overflow: 'hidden',
display: 'flex',
'align-items': 'center',
'justify-content': 'center',
}
const CodeEditorContainer = React.lazy(() => import('./CodeEditorContainer'))
const CodeEditorPreloader: React.FC = () => (
<div style={styles}>
<Spinner key="spinner" label="Loading editor..." size={SpinnerSize.large} labelPosition="bottom" />
</div>
)
/**
* Lazy-loading wrapper for code editor container
*/
export const LazyCodeEditorContainer: React.FC = () => {
return (
<React.Suspense fallback={<CodeEditorPreloader />}>
<CodeEditorContainer />
</React.Suspense>
)
}