Skip to content

Commit dc36630

Browse files
authored
fix: Center pill in Views table cells (#2895)
1 parent f9514dd commit dc36630

File tree

3 files changed

+37
-7
lines changed

3 files changed

+37
-7
lines changed

src/dashboard/Data/Views/ViewValueDialog.react.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,18 @@ export default function ViewValueDialog({ value, onClose }) {
2020
showCancel={false}
2121
onConfirm={onClose}
2222
>
23-
<Field label={<Label text="Value" />} input={<TextInput value={stringValue} multiline monospace disabled />} />
23+
<Field
24+
label={<Label text="Value" />}
25+
input={
26+
<TextInput
27+
value={stringValue}
28+
multiline
29+
monospace
30+
disabled
31+
onChange={() => {}}
32+
/>
33+
}
34+
/>
2435
</Modal>
2536
);
2637
}

src/dashboard/Data/Views/Views.react.js

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,8 @@ class Views extends TableView {
284284
}
285285
}
286286
let content = '';
287-
if (type === 'Pointer' && value && value.className && value.objectId) {
287+
const hasPill = type === 'Pointer' && value && value.className && value.objectId;
288+
if (hasPill) {
288289
const id = value.objectId;
289290
const className = value.className;
290291
content = (
@@ -301,14 +302,24 @@ class Views extends TableView {
301302
content = String(value);
302303
}
303304
const isViewable = ['String', 'Number', 'Object'].includes(type);
304-
const cellProps = {};
305+
const classes = [styles.cell];
306+
if (hasPill) {
307+
classes.push(styles.pillCell);
308+
}
309+
let cellContent = content;
305310
if (isViewable) {
306-
cellProps.onClick = () => this.handleValueClick(value);
307-
cellProps.style = { cursor: 'pointer' };
311+
cellContent = (
312+
<span
313+
className={styles.clickableText}
314+
onClick={() => this.handleValueClick(value)}
315+
>
316+
{content}
317+
</span>
318+
);
308319
}
309320
return (
310-
<td key={name} className={styles.cell} {...cellProps}>
311-
{content}
321+
<td key={name} className={classes.join(' ')}>
322+
{cellContent}
312323
</td>
313324
);
314325
})}

src/dashboard/Data/Views/Views.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,11 @@
4949
max-width: none;
5050
}
5151

52+
.tableRow td.pillCell {
53+
line-height: 8px;
54+
}
55+
56+
.clickableText {
57+
cursor: pointer;
58+
}
59+

0 commit comments

Comments
 (0)