Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(browser-repl): use an error background color that makes syntax highlighting legible COMPASS-8308 #2307

Merged
merged 2 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/browser-repl/src/components/shell-output-line.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ const shellOutputLine = css({
});

const shellOutputLineError = css({
backgroundColor: palette.red.light2,
color: palette.red.dark3,
backgroundColor: 'inherit',
color: palette.red.light1,
});

const shellOutputLineIcon = css({
Expand Down
19 changes: 16 additions & 3 deletions packages/browser-repl/src/components/types/error-output.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { isShouldReportAsBugError } from '@mongosh/errors';
import { css, cx, palette } from '@mongodb-js/compass-components';

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

const errInfoCss = css({
'&&': {
borderLeft: '3px solid',
paddingLeft: '0px',
borderColor: palette.red.light1,
},
});

const messageCss = css({
color: palette.white,
});

export class ErrorOutput extends Component<ErrorOutputProps> {
static propTypes = {
value: PropTypes.any,
Expand All @@ -30,7 +43,7 @@ export class ErrorOutput extends Component<ErrorOutputProps> {
>
{formattedName || 'Error'}:
</a>{' '}
{message}
<span className={messageCss}>{message}</span>
</pre>
</div>
);
Expand Down Expand Up @@ -87,11 +100,11 @@ export class ErrorOutput extends Component<ErrorOutputProps> {
return (
<div>
{this.renderCollapsed(toggle)}
<div>
<div className={messageCss}>
{this.formatErrorBugReportInfo()}
{this.formatErrorInfo()}
{this.formatErrorResult()}
<pre>{this.formatStack()}</pre>
<pre className={errInfoCss}>{this.formatStack()}</pre>
</div>
</div>
);
Expand Down
Loading