Skip to content

Commit 17b7506

Browse files
committed
refactor: CodeEditor - styles update
1 parent 64f98e7 commit 17b7506

File tree

3 files changed

+18
-34
lines changed

3 files changed

+18
-34
lines changed

src/Common/CodeEditor/CodeEditorRenderer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export const CodeEditorRenderer = ({
7979
) : (
8080
<div ref={codeMirrorParentDivRef} className={`w-100 ${codeEditorParentClassName}`}>
8181
{shebang && (
82-
<div className="code-editor__shebang flexbox text-white">
82+
<div className="code-editor__shebang flexbox text__white">
8383
<div className="code-editor__shebang__gutter dc__align-self-stretch" />
8484
{shebang}
8585
</div>

src/Common/CodeEditor/codeEditor.scss

Lines changed: 9 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -14,34 +14,6 @@
1414
* limitations under the License.
1515
*/
1616

17-
// CODE MIRROR THEME
18-
.cm-theme,
19-
.cm-merge-theme {
20-
&__light {
21-
--bg-code-editor-base: #ffffff;
22-
--bg-code-editor-base-gutter: #f7fafc;
23-
--bg-code-editor-red: #fdf0f0;
24-
--bg-code-editor-red-gutter: #fde7e7;
25-
--bg-code-editor-red-highlight: #fcbcbc;
26-
--bg-code-editor-green: #f2fffa;
27-
--bg-code-editor-green-gutter: #e9fbf4;
28-
--bg-code-editor-green-highlight: #b6e9d3;
29-
--active-line: #f0f7ff;
30-
}
31-
32-
&__dark {
33-
--bg-code-editor-base: #181920;
34-
--bg-code-editor-base-gutter: #15161f;
35-
--bg-code-editor-red: #311f27;
36-
--bg-code-editor-red-gutter: #44242c;
37-
--bg-code-editor-red-highlight: #733239;
38-
--bg-code-editor-green: #212b2b;
39-
--bg-code-editor-green-gutter: #293932;
40-
--bg-code-editor-green-highlight: #3d5c46;
41-
--active-line: #28364c;
42-
}
43-
}
44-
4517
// CODE MIRROR OVERRIDES
4618
.cm-mergeView {
4719
height: 100%;
@@ -94,6 +66,7 @@
9466

9567
.cm-panels {
9668
background-color: var(--bg-code-editor);
69+
z-index: 0;
9770
}
9871

9972
.cm-panels-top {
@@ -125,12 +98,15 @@
12598
}
12699

127100
&:has(.cm-tooltip-lint) .code-editor__schema-tooltip {
128-
border-top: 1px solid var(--N100);
129101
border-top-left-radius: 0;
130102
border-top-right-radius: 0;
131103
}
132104
}
133105

106+
.cm-tooltip-section:not(:first-child) {
107+
border-top: 1px solid var(--N100);
108+
}
109+
134110
.cm-tooltip-lint {
135111
color: var(--white);
136112
background-color: var(--bg-tooltip-black);
@@ -199,6 +175,10 @@
199175
.code-editor {
200176
&__schema-tooltip {
201177
background-color: var(--bg-tooltip-black);
178+
179+
&__source {
180+
color: var(--button-text-on-dark);
181+
}
202182
}
203183

204184
&__container {

src/Common/CodeEditor/utils.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export const getFoldGutterElement = (open: boolean) => {
9999
const getHoverElement = (schemaURI: CodeEditorProps['schemaURI']) => (data: HoverTexts) => {
100100
const hoverContainer = document.createElement('div')
101101
const node = (
102-
<div className="code-editor__schema-tooltip dc__mxw-300 flexbox-col px-10 py-6 br-4 fs-12 lh-18 text-white">
102+
<div className="code-editor__schema-tooltip dc__mxw-300 flexbox-col px-10 py-6 br-4 fs-12 lh-18 text__white">
103103
{data.message && <p className="m-0">{data.message}</p>}
104104
{data.typeInfo && (
105105
<p
@@ -111,22 +111,26 @@ const getHoverElement = (schemaURI: CodeEditorProps['schemaURI']) => (data: Hove
111111
/>
112112
)}
113113
{schemaURI && (
114-
<a className="m-0 dc__w-fit-content" href={schemaURI} target="_blank" rel="noreferrer">
114+
<a
115+
className="m-0 dc__w-fit-content code-editor__schema-tooltip__source"
116+
href={schemaURI}
117+
target="_blank"
118+
rel="noreferrer"
119+
>
115120
Source
116121
</a>
117122
)}
118123
</div>
119124
)
120125

121-
hoverContainer.classList.add('dc__w-fit-content')
122126
hoverContainer.innerHTML = renderToString(node)
123127
return hoverContainer
124128
}
125129

126130
export const getReadOnlyElement = () => {
127131
const dom = document.createElement('div')
128132
const node = (
129-
<div className="code-editor__read-only-tooltip py-6 px-10 br-4 text-white">
133+
<div className="code-editor__read-only-tooltip py-6 px-10 br-4 text__white">
130134
<p className="m-0 fs-12 lh-18">Cannot edit in read-only editor</p>
131135
</div>
132136
)

0 commit comments

Comments
 (0)