|
1 | 1 | import { Panel, Widget } from "@lumino/widgets"; |
2 | 2 | import type { CellDiffWidget } from "./"; |
| 3 | +import { LabIcon } from "@jupyterlab/ui-components"; |
3 | 4 |
|
4 | 5 | import foldDown from "./fold-down.svg"; |
5 | 6 | import foldUp from "./fold-up.svg"; |
6 | 7 | import fold from "./fold.svg"; |
7 | 8 |
|
| 9 | +export const foldDownIcon = new LabIcon({ |
| 10 | + name: "nbdime:fold-down", |
| 11 | + svgstr: foldDown |
| 12 | +}); |
| 13 | + |
| 14 | +export const foldUpIcon = new LabIcon({ |
| 15 | + name: "nbdime:fold-up", |
| 16 | + svgstr: foldUp |
| 17 | +}); |
| 18 | + |
| 19 | +export const foldIcon = new LabIcon({ |
| 20 | + name: "nbdime:fold", |
| 21 | + svgstr: fold |
| 22 | +}); |
| 23 | + |
| 24 | +export interface ILinkedListCell { |
| 25 | + next: () => ILinkedListCell | null; |
| 26 | + prev: () => ILinkedListCell | null; |
| 27 | + displayed: () => boolean; |
| 28 | + lazy: boolean; |
| 29 | + expandUp: () => void; |
| 30 | + expandDown: () => void; |
| 31 | +} |
| 32 | + |
8 | 33 | class LinkedListCell extends Panel { |
9 | 34 | _next: LinkedListCell | LazyDisplayLinkedListCell | null; |
10 | 35 | _prev: LinkedListCell | LazyDisplayLinkedListCell | null; |
@@ -159,19 +184,15 @@ class LazyDisplayLinkedListCell extends LinkedListCell { |
159 | 184 | const button = document.createElement("a"); |
160 | 185 | button.title = `Expand ${direction}`; |
161 | 186 | button.setAttribute("aria-label", `Expand ${direction}`); |
162 | | - button.innerHTML = this.buttonSvg(direction); |
163 | | - if (direction === "Up") { |
164 | | - button.innerHTML = foldUp; |
165 | | - } else if (direction === "Down") { |
166 | | - button.innerHTML = foldDown; |
167 | | - } else { |
168 | | - button.innerHTML = fold; |
169 | | - } |
| 187 | + let icon = this.buttonSvg(direction); |
| 188 | + icon.element({ |
| 189 | + container: button, |
| 190 | + }) |
170 | 191 | this.expandButtonDisplayed = true; |
171 | 192 | return button; |
172 | 193 | } |
173 | 194 |
|
174 | | - buttonSvg(direction: "Up" | "Down" | "Fold"): string { |
| 195 | + buttonSvg(direction: "Up" | "Down" | "Fold"): LabIcon { |
175 | 196 | if (direction === "Up") { |
176 | 197 | return foldUp; |
177 | 198 | } else if (direction === "Down") { |
|
0 commit comments