Skip to content

Commit 507d68c

Browse files
committed
Fix caret icon in diagnostics panel (port to JupyterLab 2.0) #258
1 parent d1d8c13 commit 507d68c

File tree

2 files changed

+23
-22
lines changed

2 files changed

+23
-22
lines changed

packages/jupyterlab-lsp/src/adapters/codemirror/features/diagnostics_listing.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React, { ReactElement } from 'react';
22
import { VDomModel, VDomRenderer } from '@jupyterlab/apputils';
3+
import { caretDownIcon, caretUpIcon } from '@jupyterlab/ui-components';
34
import * as lsProtocol from 'vscode-languageserver-protocol';
45
import * as CodeMirror from 'codemirror';
56
import { IEditorPosition } from '../../../positioning';
@@ -161,19 +162,18 @@ class Column {
161162

162163
function SortableTH(props: { name: string; listing: DiagnosticsListing }): any {
163164
const is_sort_key = props.name === props.listing.sort_key;
165+
const sortIcon =
166+
props.listing.sort_direction === 1 ? caretUpIcon : caretDownIcon;
164167
return (
165168
<th
166169
key={props.name}
167170
onClick={() => props.listing.sort(props.name)}
168-
className={
169-
is_sort_key
170-
? 'lsp-sorted ' +
171-
(props.listing.sort_direction === 1 ? 'lsp-descending' : '')
172-
: ''
173-
}
171+
className={is_sort_key ? 'lsp-sorted-header' : null}
174172
>
175173
{props.name}
176-
{is_sort_key ? <span className={'lsp-caret'} /> : null}
174+
{is_sort_key ? (
175+
<sortIcon.react tag="span" className="lsp-sort-icon" />
176+
) : null}
177177
</th>
178178
);
179179
}

packages/jupyterlab-lsp/style/diagnostics_listing.css

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -57,24 +57,25 @@
5757
background: var(--jp-layout-color2);
5858
}
5959

60-
.lsp-sort-caret {
61-
height: 16px;
62-
width: 16px;
63-
background-size: 18px;
64-
background-image: 18px;
65-
background-repeat: no-repeat;
66-
background-position: center;
67-
display: inline-block;
68-
position: relative;
69-
top: 3px;
60+
.lsp-sorted-header {
61+
flex: 0 0 auto;
62+
display: flex;
63+
flex-direction: row;
64+
overflow: hidden;
7065
}
7166

72-
.lsp-sorted .lsp-caret {
73-
background-image: var(--jp-icon-caretup);
74-
margin-top: -4px;
67+
.lsp-sort-icon {
68+
top: -3px;
7569
left: 3px;
70+
position: relative;
71+
height: 16px;
72+
width: 16px;
73+
display: block;
74+
margin-left: auto;
7675
}
7776

78-
.lsp-sorted.lsp-descending .lsp-caret {
79-
background-image: var(--jp-icon-caretdown);
77+
.lsp-sort-icon svg {
78+
width: 20px;
79+
display: inline;
80+
height: auto;
8081
}

0 commit comments

Comments
 (0)