11/*
2+ * Copyright 2025 znai maintainers
23 * Copyright 2019 TWO SIGMA OPEN SOURCE, LLC
34 *
45 * Licensed under the Apache License, Version 2.0 (the "License");
1415 * limitations under the License.
1516 */
1617
17- import React from ' react'
18- import JupyterCell from ' ./JupyterCell'
18+ import React from " react" ;
19+ import JupyterCell from " ./JupyterCell" ;
1920
20- import { elementsLibrary } from ' ../DefaultElementsLibrary'
21+ import { elementsLibrary } from " ../DefaultElementsLibrary" ;
2122
2223const simpleNotebook = {
23- cells : [
24- {
25- "cellType" : "code" ,
26- "lang" : "python" ,
27- "snippet" : "from pandas import read_csv\nfrom IPython.display import display" ,
28- "type" : "JupyterCell"
29- } ,
30- {
31- cellType : "output" ,
32- text :
33- " a b c\n" +
34- "0 1 2 3\n" +
35- "1 4 5 6\n"
36- } ,
37- {
38- cellType : "output" ,
39- html : `
24+ cells : [
25+ {
26+ cellType : "code" ,
27+ lang : "python" ,
28+ snippet : "from pandas import read_csv\nfrom IPython.display import display" ,
29+ type : "JupyterCell" ,
30+ } ,
31+ {
32+ cellType : "output" ,
33+ text : " a b c\n" + "0 1 2 3\n" + "1 4 5 6\n" ,
34+ } ,
35+ {
36+ cellType : "output" ,
37+ html : `
4038 <div>
41- <style scoped>
42- .dataframe tbody tr th:only-of-type {
43- vertical-align: middle;
44- }
45-
46- .dataframe tbody tr th {
47- vertical-align: top;
48- }
49-
50- .dataframe thead th {
51- text-align: right;
52- }
53- </style>
39+ <style>
40+ .dataframe > thead > tr,
41+ .dataframe > tbody > tr {
42+ text-align: right;
43+ white-space: pre-wrap;
44+ }
45+ </style>
5446 <table border="1" class="dataframe">
5547 <thead>
5648 <tr style="text-align: right;">
@@ -63,26 +55,26 @@ const simpleNotebook = {
6355 <tbody>
6456 <tr>
6557 <th>0</th>
66- <td>1 </td>
58+ <td>11 </td>
6759 <td>2</td>
6860 <td>3</td>
6961 </tr>
7062 <tr>
7163 <th>1</th>
7264 <td>4</td>
73- <td>5 </td>
65+ <td>50 </td>
7466 <td>6</td>
7567 </tr>
7668 </tbody>
7769 </table>
78- </div> `
79- }
80- ]
81- }
70+ </div> ` ,
71+ } ,
72+ ] ,
73+ } ;
8274
8375export function jupyterDemo ( registry ) {
84- registry
85- . add ( ' code cell' , ( ) => < JupyterCell elementsLibrary = { elementsLibrary } { ...simpleNotebook . cells [ 0 ] } /> )
86- . add ( ' output text cell' , ( ) => < JupyterCell elementsLibrary = { elementsLibrary } { ...simpleNotebook . cells [ 1 ] } /> )
87- . add ( ' output htlml cell' , ( ) => < JupyterCell elementsLibrary = { elementsLibrary } { ...simpleNotebook . cells [ 2 ] } /> )
76+ registry
77+ . add ( " code cell" , ( ) => < JupyterCell elementsLibrary = { elementsLibrary } { ...simpleNotebook . cells [ 0 ] } /> )
78+ . add ( " output text cell" , ( ) => < JupyterCell elementsLibrary = { elementsLibrary } { ...simpleNotebook . cells [ 1 ] } /> )
79+ . add ( " output htlml cell" , ( ) => < JupyterCell elementsLibrary = { elementsLibrary } { ...simpleNotebook . cells [ 2 ] } /> ) ;
8880}
0 commit comments