Skip to content

Commit 2d5e272

Browse files
committed
Add some comments to explain CSS customizations
1 parent 993fc05 commit 2d5e272

File tree

1 file changed

+97
-83
lines changed
  • packages/notebook-extension/style

1 file changed

+97
-83
lines changed

packages/notebook-extension/style/base.css

Lines changed: 97 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -6,34 +6,25 @@
66

77
@import './variables.css';
88

9-
/* Document oriented look for the notebook (scrollbar to the right of the page) */
9+
/**
10+
Document oriented look for the notebook.
11+
This includes changes to the look and feel of the JupyterLab Notebook
12+
component like:
13+
- scrollbar to the right of the page
14+
- drop shadow on the notebook
15+
- smaller empty space at the bottom of the notebook
16+
- compact view on mobile
17+
*/
18+
19+
/* Keep the notebook centered on the page */
1020

1121
body[data-notebook='notebooks'] .jp-NotebookPanel-toolbar {
1222
padding-left: calc(calc(100% - var(--jp-notebook-max-width)) * 0.5);
1323
padding-right: calc(calc(100% - var(--jp-notebook-max-width)) * 0.5);
1424
}
1525

16-
body[data-notebook='notebooks'] .jp-Notebook > * {
17-
background: var(--jp-layout-color0);
18-
}
19-
20-
body[data-notebook='notebooks']
21-
.jp-Notebook.jp-mod-commandMode
22-
.jp-Cell.jp-mod-active.jp-mod-selected:not(.jp-mod-multiSelected) {
23-
background: var(--jp-layout-color0) !important;
24-
}
25-
26-
body[data-notebook='notebooks'] .jp-WindowedPanel-inner {
27-
margin-top: var(--jp-notebook-toolbar-margin-bottom);
28-
}
29-
30-
body[data-notebook='notebooks'] .jp-Notebook > *:first-child:not(:last-child) {
31-
box-shadow: 0px 0px 12px 1px var(--jp-shadow-umbra-color);
32-
}
33-
3426
body[data-notebook='notebooks'] .jp-Notebook {
3527
padding-top: unset;
36-
padding-bottom: unset;
3728
padding-left: calc(calc(100% - var(--jp-notebook-max-width)) * 0.5);
3829
padding-right: calc(
3930
calc(
@@ -43,12 +34,37 @@ body[data-notebook='notebooks'] .jp-Notebook {
4334
background: var(--jp-layout-color2);
4435
}
4536

37+
body[data-notebook='notebooks'] .jp-WindowedPanel-inner {
38+
margin-top: var(--jp-notebook-toolbar-margin-bottom);
39+
}
40+
41+
body[data-notebook='notebooks'] .jp-Notebook-cell {
42+
background: var(--jp-layout-color0);
43+
padding-left: calc(2 * var(--jp-cell-padding));
44+
padding-right: calc(2 * var(--jp-cell-padding));
45+
}
46+
47+
/* Empty space at the bottom of the notebook (similar to classic) */
4648
body[data-notebook='notebooks'] .jp-Notebook.jp-mod-scrollPastEnd::after {
4749
min-height: 100px;
4850
}
4951

50-
/* body[data-notebook='notebooks'] .jp-WindowedPanel-window > *:first-child { */
51-
/* TODO: revisit when https://github.com/jupyterlab/jupyterlab/issues/13151 is fixed */
52+
/* Fix background colors */
53+
54+
body[data-notebook='notebooks'] .jp-Notebook > * {
55+
background: var(--jp-layout-color0);
56+
}
57+
58+
body[data-notebook='notebooks']
59+
.jp-Notebook.jp-mod-commandMode
60+
.jp-Cell.jp-mod-active.jp-mod-selected:not(.jp-mod-multiSelected) {
61+
background: var(--jp-layout-color0) !important;
62+
}
63+
64+
/**
65+
Extra padding to the first and and last cell of the notebook.
66+
TODO: revisit when https://github.com/jupyterlab/jupyterlab/issues/13151 is fixed
67+
*/
5268
.jp-Notebook-cell[data-windowed-list-index='0'] {
5369
padding-top: calc(2 * var(--jp-notebook-padding));
5470
}
@@ -106,7 +122,65 @@ body[data-notebook='notebooks']
106122
}
107123
}
108124

109-
/* ---- */
125+
/* Mobile View */
126+
127+
body[data-format='mobile'] .jp-NotebookCheckpoint {
128+
display: none;
129+
}
130+
131+
body[data-format='mobile'] .jp-Notebook > *:first-child {
132+
margin-top: 0;
133+
}
134+
135+
/* Virtual Notebook fixes */
136+
137+
body[data-notebook='notebooks'] .jp-WindowedPanel-window {
138+
background: var(--jp-layout-color0);
139+
/* TODO: remove when https://github.com/jupyterlab/jupyterlab/pull/13154 is released */
140+
width: unset;
141+
}
142+
143+
body[data-notebook='notebooks'] .jp-WindowedPanel-inner {
144+
/* TODO: remove when https://github.com/jupyterlab/jupyterlab/pull/13157 is released */
145+
width: unset;
146+
}
147+
148+
/* Notebook box shadow */
149+
150+
body[data-notebook='notebooks'] .jp-Notebook > *:first-child:not(:last-child) {
151+
box-shadow: 0px 0px 12px 1px var(--jp-shadow-umbra-color);
152+
}
153+
154+
body[data-notebook='notebooks'] .jp-Notebook > *:first-child:not(:last-child) {
155+
box-shadow: 0px 0px 12px 1px var(--jp-shadow-umbra-color);
156+
}
157+
158+
body[data-notebook='notebooks']
159+
.jp-Notebook
160+
> *:first-child:last-child::before {
161+
content: '';
162+
position: absolute;
163+
top: 0;
164+
bottom: 0;
165+
left: 0;
166+
right: 0;
167+
box-shadow: 0px 0px 12px 1px var(--jp-shadow-umbra-color);
168+
}
169+
170+
body[data-notebook='notebooks']
171+
.jp-Notebook
172+
.jp-Notebook-cell:not(:first-child)::after,
173+
body[data-notebook='notebooks']
174+
.jp-Notebook
175+
.jp-Notebook-cell:not(:first-child)::before {
176+
content: ' ';
177+
height: 100%;
178+
position: absolute;
179+
top: 0;
180+
width: 11px;
181+
}
182+
183+
/* Additional customizations of the components on the notebook page */
110184

111185
.jp-NotebookKernelLogo {
112186
flex: 0 0 auto;
@@ -187,63 +261,3 @@ body[data-notebook='notebooks']
187261
overflow: hidden;
188262
white-space: nowrap;
189263
}
190-
191-
/* Mobile View */
192-
193-
body[data-format='mobile'] .jp-NotebookCheckpoint {
194-
display: none;
195-
}
196-
197-
body[data-format='mobile'] .jp-Notebook > *:first-child {
198-
margin-top: 0;
199-
}
200-
201-
/* Virtual Notebook fixes */
202-
203-
body[data-notebook='notebooks'] .jp-WindowedPanel-window {
204-
background: var(--jp-layout-color0);
205-
/* TODO: remove when https://github.com/jupyterlab/jupyterlab/pull/13154 is released */
206-
width: unset;
207-
}
208-
209-
body[data-notebook='notebooks'] .jp-WindowedPanel-inner {
210-
/* TODO: remove when https://github.com/jupyterlab/jupyterlab/pull/13157 is released */
211-
width: unset;
212-
}
213-
214-
body[data-notebook='notebooks'] .jp-Notebook-cell {
215-
background: var(--jp-layout-color0);
216-
padding-left: calc(2 * var(--jp-cell-padding));
217-
padding-right: calc(2 * var(--jp-cell-padding));
218-
}
219-
220-
/* Notebook box shadow */
221-
222-
body[data-notebook='notebooks'] .jp-Notebook > *:first-child:not(:last-child) {
223-
box-shadow: 0px 0px 12px 1px var(--jp-shadow-umbra-color);
224-
}
225-
226-
body[data-notebook='notebooks']
227-
.jp-Notebook
228-
> *:first-child:last-child::before {
229-
content: '';
230-
position: absolute;
231-
top: 0;
232-
bottom: 0;
233-
left: 0;
234-
right: 0;
235-
box-shadow: 0px 0px 12px 1px var(--jp-shadow-umbra-color);
236-
}
237-
238-
body[data-notebook='notebooks']
239-
.jp-Notebook
240-
.jp-Notebook-cell:not(:first-child)::after,
241-
body[data-notebook='notebooks']
242-
.jp-Notebook
243-
.jp-Notebook-cell:not(:first-child)::before {
244-
content: ' ';
245-
height: 100%;
246-
position: absolute;
247-
top: 0;
248-
width: 11px;
249-
}

0 commit comments

Comments
 (0)