Skip to content

Commit fca5e6f

Browse files
committed
Add light mode style to code editor
1 parent 112367c commit fca5e6f

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

packages/compass-indexes/src/components/create-index-form/query-flow-section.tsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
cx,
77
useFocusRing,
88
ParagraphSkeleton,
9+
useDarkMode,
910
} from '@mongodb-js/compass-components';
1011
import type { Document } from 'mongodb';
1112
import React, { useMemo, useCallback } from 'react';
@@ -61,7 +62,6 @@ const codeEditorContainerStyles = css({
6162
const codeEditorStyles = css({
6263
borderRadius: editorContainerRadius,
6364
'& .cm-editor': {
64-
background: `${palette.white} !important`,
6565
borderRadius: editorContainerRadius,
6666
},
6767
'& .cm-content': {
@@ -70,6 +70,12 @@ const codeEditorStyles = css({
7070
},
7171
});
7272

73+
const lightModeCodeEditorStyles = css({
74+
'& .cm-editor': {
75+
background: `${palette.white} !important`,
76+
},
77+
});
78+
7379
const indexSuggestionsLoaderStyles = css({
7480
marginBottom: spacing[600],
7581
padding: spacing[600],
@@ -109,6 +115,7 @@ const QueryFlowSection = ({
109115
fetchingSuggestionsState: IndexSuggestionState;
110116
initialQuery: Document | null;
111117
}) => {
118+
const darkMode = useDarkMode();
112119
const [inputQuery, setInputQuery] = React.useState(
113120
JSON.stringify(initialQuery ?? '', null, 2)
114121
);
@@ -199,7 +206,10 @@ const QueryFlowSection = ({
199206
onChangeText={(text) => handleQueryInputChange(text)}
200207
placeholder="Type a query: { field: 'value' }"
201208
completer={completer}
202-
className={codeEditorStyles}
209+
className={cx(
210+
codeEditorStyles,
211+
!darkMode && lightModeCodeEditorStyles
212+
)}
203213
/>
204214
</div>
205215

0 commit comments

Comments
 (0)