Skip to content

Commit 6bed078

Browse files
Merge pull request #58 from usernamehw/row_hover
Highlight row on hover
2 parents abe877a + 3414c54 commit 6bed078

File tree

2 files changed

+23
-9
lines changed

2 files changed

+23
-9
lines changed

src/renderer/render.ts

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import type {
2-
RendererContext,
3-
OutputItem
4-
}
5-
from 'vscode-notebook-renderer';
6-
import {OutputLoader} from './outputLoader';
2+
OutputItem, RendererContext
3+
} from 'vscode-notebook-renderer';
4+
import { OutputLoader } from './outputLoader';
75
const aq = require('arquero');
86
const inputs = require('@observablehq/inputs');
97

@@ -51,7 +49,7 @@ export function render(output: IRenderInfo) {
5149
}
5250
else {
5351
// output text in pre/code tags
54-
output.container.innerHTML = `<pre
52+
output.container.innerHTML = `<pre
5553
style="max-height: 300px; white-space: pre-wrap; tab-size: 2; overflow: auto;">
5654
<code style="display: block; white-space: pre-wrap;">${data}</code>
5755
</pre>`;
@@ -77,7 +75,7 @@ if (module.hot) {
7775

7876
if (typeof data.size === 'number') {
7977
// map or set
80-
return data.size;
78+
return data.size;
8179
}
8280

8381
if (typeof data.numRows === 'function') {
@@ -102,18 +100,26 @@ function addStyles(document: HTMLDocument): HTMLStyleElement {
102100
margin: 0px !important;
103101
}
104102
103+
tbody tr:hover {
104+
box-shadow: inset 0 0 1500px 100px rgba(255, 255, 255, 0.1);
105+
}
106+
107+
.vscode-light tbody tr:hover {
108+
box-shadow: inset 0 0 1500px 100px rgba(0, 0, 0, 0.1);
109+
}
110+
105111
.data-table form table thead th {
106112
background-color: var(--vscode-editor-background) !important;
107113
}
108114
109115
thead th {
110116
box-shadow: 0 1px 0 var(--vscode-panel-border) !important;
111117
}
112-
118+
113119
th {
114120
text-align: left !important;
115121
}
116122
`;
117-
123+
118124
return styles;
119125
}

src/renderer/style.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@
88
margin: 0px !important;
99
}
1010

11+
tbody tr:hover {
12+
box-shadow: inset 0 0 1500px 100px rgba(255, 255, 255, 0.1);
13+
}
14+
15+
.vscode-light tbody tr:hover {
16+
box-shadow: inset 0 0 1500px 100px rgba(0, 0, 0, 0.1);
17+
}
18+
1119
.data-table form table thead th {
1220
background-color: var(--vscode-editor-background) !important;
1321
}

0 commit comments

Comments
 (0)