From eaa64728b7016aab3a901e8886652f0612adb22c Mon Sep 17 00:00:00 2001 From: Kristóf Marussy Date: Fri, 12 Aug 2022 20:20:44 +0200 Subject: refactor(frontend): EditorParent line numbers --- subprojects/frontend/src/editor/EditorParent.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'subprojects/frontend/src/editor/EditorParent.ts') diff --git a/subprojects/frontend/src/editor/EditorParent.ts b/subprojects/frontend/src/editor/EditorParent.ts index dbc35a0d..a4cdfa38 100644 --- a/subprojects/frontend/src/editor/EditorParent.ts +++ b/subprojects/frontend/src/editor/EditorParent.ts @@ -19,7 +19,8 @@ function underline(color: string) { export default styled('div', { name: 'EditorParent', -})(({ theme }) => { + shouldForwardProp: (propName) => propName !== 'showLineNumbers', +})<{ showLineNumbers: boolean }>(({ theme, showLineNumbers }) => { const codeMirrorLintStyle: Record = {}; (['error', 'warning', 'info'] as const).forEach((severity) => { const color = theme.palette[severity].main; @@ -77,8 +78,13 @@ export default styled('div', { '.cm-activeLineGutter': { background: 'transparent', }, - '.cm-lineNumbers .cm-activeLineGutter': { - color: theme.palette.text.primary, + '.cm-lineNumbers': { + ...(!showLineNumbers && { + display: 'none !important', + }), + '.cm-activeLineGutter': { + color: theme.palette.text.primary, + }, }, '.cm-cursor, .cm-cursor-primary': { borderLeft: `2px solid ${theme.palette.primary.main}`, -- cgit v1.2.3-70-g09d2