Skip to content

Commit 712d623

Browse files
Merge pull request #57 from usernamehw/cell_border
Import styles from css file
2 parents 6bed078 + 291c3df commit 712d623

File tree

3 files changed

+4
-49
lines changed

3 files changed

+4
-49
lines changed

src/renderer/render.ts

Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import type {
44
import { OutputLoader } from './outputLoader';
55
const aq = require('arquero');
66
const inputs = require('@observablehq/inputs');
7+
import './style.css';
78

89
/**
910
* Notebook cell output render info.
@@ -32,9 +33,6 @@ export function render(output: IRenderInfo) {
3233
break;
3334
}
3435

35-
// add data table view styles
36-
addStyles(document);
37-
3836
if (Array.isArray(data)) {
3937
// create data table view
4038
const table = inputs.table(data, {
@@ -85,41 +83,3 @@ if (module.hot) {
8583

8684
return 0;
8785
}
88-
89-
function addStyles(document: HTMLDocument): HTMLStyleElement {
90-
const styles: HTMLStyleElement = document.createElement('style');
91-
document.head.appendChild(styles);
92-
styles.textContent = `
93-
.data-table {
94-
max-width: 100%;
95-
background-color: var(--vscode-editor-background);
96-
border: 1px solid var(--vscode-panel-border);
97-
}
98-
99-
.data-table form {
100-
margin: 0px !important;
101-
}
102-
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-
111-
.data-table form table thead th {
112-
background-color: var(--vscode-editor-background) !important;
113-
}
114-
115-
thead th {
116-
box-shadow: 0 1px 0 var(--vscode-panel-border) !important;
117-
}
118-
119-
th {
120-
text-align: left !important;
121-
}
122-
`;
123-
124-
return styles;
125-
}

src/renderer/style.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,4 @@ thead th {
2727
th {
2828
text-align: left !important;
2929
}
30+

webpack.config.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,21 +43,15 @@ module.exports = (env, argv) => ({
4343
test: /\.css$/,
4444
use: [
4545
'style-loader',
46-
{
47-
loader: 'css-loader',
48-
options: {
49-
importLoaders: 1,
50-
modules: true,
51-
},
52-
},
46+
'css-loader',
5347
],
5448
},
5549
],
5650
},
5751
devServer: {
5852
port: devServerPort,
5953
hot: true,
60-
// disable host check, otherwise the bundle running in vscode
54+
// disable host check, otherwise the bundle running in vscode
6155
// won't be able to connect to the dev server
6256
disableHostCheck: true,
6357
writeToDisk: true,

0 commit comments

Comments
 (0)