-
-
Notifications
You must be signed in to change notification settings - Fork 41
/
Viewer.tsx
41 lines (37 loc) 路 985 Bytes
/
Viewer.tsx
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
/*
* Copyright (c) 2022-2023 Datalayer Inc. All rights reserved.
*
* MIT License
*/
import { useState, useEffect } from 'react';
import { INotebookContent } from '@jupyterlab/nbformat';
import InputViewer from './input/InputViewer';
// import OutputViewer from './output/OutputViewer';
import { newUuid } from '../../utils/Utils';
type Props = {
nbformat: INotebookContent;
outputs: boolean;
}
export const Viewer = (props: Props) => {
const { nbformat } = props;
const [model, setModel] = useState<INotebookContent>()
useEffect(() => {
setModel(nbformat);
}, [nbformat])
return (
<>
{model?.cells.map(cell => {
return (
<div key={cell.id?.toString() || newUuid()}>
<InputViewer
cell={cell}
languageInfo={nbformat.metadata.language_info}
/>
{/* cell.outputs && <OutputViewer cell={cell}/> */}
</div>
)
})}
</>
);
}
export default Viewer;