Skip to content

Commit 0919d39

Browse files
fix(browser-repl): use an error background color that makes syntax highlighting legible COMPASS-8308 (#2307)
* fix error formatting * more color
1 parent 62aebdf commit 0919d39

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

packages/browser-repl/src/components/shell-output-line.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ const shellOutputLine = css({
1919
});
2020

2121
const shellOutputLineError = css({
22-
backgroundColor: palette.red.light2,
23-
color: palette.red.dark3,
22+
backgroundColor: 'inherit',
23+
color: palette.red.light1,
2424
});
2525

2626
const shellOutputLineIcon = css({

packages/browser-repl/src/components/types/error-output.tsx

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React, { Component } from 'react';
22
import PropTypes from 'prop-types';
33
import { isShouldReportAsBugError } from '@mongosh/errors';
4+
import { css, cx, palette } from '@mongodb-js/compass-components';
45

56
import { SimpleTypeOutput } from './simple-type-output';
67
import { Expandable } from '../utils/expandable';
@@ -10,6 +11,18 @@ interface ErrorOutputProps {
1011
value: any;
1112
}
1213

14+
const errInfoCss = css({
15+
'&&': {
16+
borderLeft: '3px solid',
17+
paddingLeft: '0px',
18+
borderColor: palette.red.light1,
19+
},
20+
});
21+
22+
const messageCss = css({
23+
color: palette.white,
24+
});
25+
1326
export class ErrorOutput extends Component<ErrorOutputProps> {
1427
static propTypes = {
1528
value: PropTypes.any,
@@ -30,7 +43,7 @@ export class ErrorOutput extends Component<ErrorOutputProps> {
3043
>
3144
{formattedName || 'Error'}:
3245
</a>{' '}
33-
{message}
46+
<span className={messageCss}>{message}</span>
3447
</pre>
3548
</div>
3649
);
@@ -87,11 +100,11 @@ export class ErrorOutput extends Component<ErrorOutputProps> {
87100
return (
88101
<div>
89102
{this.renderCollapsed(toggle)}
90-
<div>
103+
<div className={messageCss}>
91104
{this.formatErrorBugReportInfo()}
92105
{this.formatErrorInfo()}
93106
{this.formatErrorResult()}
94-
<pre>{this.formatStack()}</pre>
107+
<pre className={errInfoCss}>{this.formatStack()}</pre>
95108
</div>
96109
</div>
97110
);

0 commit comments

Comments
 (0)