Skip to content

Commit 289f070

Browse files
authored
[playground] Improve DiffEditor scrollbar + view (#34691)
The previous DiffEditor view of the playground looked broken and not cohesive. There would be parts of the scrollbar appearing on the left side for some reason, along with two scrollbars on the right side. This PR makes the DiffEditor look more cohesive. Previous: https://github.com/user-attachments/assets/1aa1c775-5940-43b2-a75a-9b46452fb78b After: https://github.com/user-attachments/assets/b5c04998-6a6c-4b52-b3c5-b2fef21729e0
1 parent 6a8a8ef commit 289f070

File tree

4 files changed

+18
-9
lines changed

4 files changed

+18
-9
lines changed

compiler/apps/playground/components/AccordionWindow.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
import {Resizable} from 're-resizable';
99
import React, {
10-
useCallback,
1110
useId,
1211
unstable_ViewTransition as ViewTransition,
1312
unstable_addTransitionType as addTransitionType,
@@ -66,7 +65,7 @@ function AccordionWindowItem({
6665

6766
const transitionName = `accordion-window-item-${id}`;
6867

69-
const toggleTabs = () => {
68+
const toggleTabs = (): void => {
7069
startTransition(() => {
7170
addTransitionType(EXPAND_ACCORDION_TRANSITION);
7271
const nextState = new Set(tabsOpen);

compiler/apps/playground/components/Editor/EditorImpl.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,7 @@ import BabelPluginReactCompiler, {
2424
printFunctionWithOutlined,
2525
type LoggerEvent,
2626
} from 'babel-plugin-react-compiler';
27-
import {
28-
useDeferredValue,
29-
useMemo,
30-
unstable_ViewTransition as ViewTransition,
31-
} from 'react';
27+
import {useDeferredValue, useMemo} from 'react';
3228
import {useStore} from '../StoreContext';
3329
import ConfigEditor from './ConfigEditor';
3430
import Input from './Input';

compiler/apps/playground/components/Editor/Output.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,12 +372,18 @@ function TextTabContent({
372372
loading={''}
373373
options={{
374374
...monacoOptions,
375+
scrollbar: {
376+
vertical: 'hidden',
377+
},
378+
dimension: {
379+
width: 0,
380+
height: 0,
381+
},
375382
readOnly: true,
376383
lineNumbers: 'off',
377384
glyphMargin: false,
378385
// Undocumented see https://github.com/Microsoft/vscode/issues/30795#issuecomment-410998882
379-
lineDecorationsWidth: 0,
380-
lineNumbersMinChars: 0,
386+
overviewRulerLanes: 0,
381387
}}
382388
/>
383389
) : (

compiler/apps/playground/styles/globals.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,3 +124,11 @@
124124
::view-transition-group(.expand-accordion) {
125125
overflow: clip;
126126
}
127+
128+
/**
129+
* For some reason, the original Monaco editor is still visible to the
130+
* left of the DiffEditor. This is a workaround for better visual clarity.
131+
*/
132+
.monaco-diff-editor .editor.original{
133+
visibility: hidden !important;
134+
}

0 commit comments

Comments
 (0)