Skip to content

Commit a1cc8c7

Browse files
Fix white playground border (#1137)
* Fix white playground border * Remove unnecessary outer scrollbar * No overflow rules needed on main
1 parent 8f6c7b2 commit a1cc8c7

File tree

2 files changed

+38
-7
lines changed

2 files changed

+38
-7
lines changed

src/Playground.res

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ module ResultPane = {
364364
~focusedRowCol: option<(int, int)>=?,
365365
~result: FinalResult.t,
366366
) =>
367-
<div className="pt-4 bg-0 overflow-y-auto">
367+
<div className="pt-4 bg-0 overflow-y-auto playground-scrollbar">
368368
<div className="flex items-center text-16 font-medium px-4">
369369
<div className="pr-4"> {renderTitle(result)} </div>
370370
</div>
@@ -765,7 +765,7 @@ module WarningFlagsWidget = {
765765
Option.map(suggestions, elements =>
766766
<div
767767
ref={ReactDOM.Ref.domRef((Obj.magic(listboxRef): React.ref<Nullable.t<Dom.element>>))}
768-
className="p-2 absolute overflow-auto z-50 border-b rounded border-l border-r block w-full bg-gray-100 max-h-60"
768+
className="p-2 absolute overflow-auto playground-scrollbar z-50 border-b rounded border-l border-r block w-full bg-gray-100 max-h-60"
769769
>
770770
elements
771771
</div>
@@ -1523,6 +1523,12 @@ let make = (~bundleBaseUrl: string, ~versions: array<string>) => {
15231523
let (searchParams, _) = ReactRouter.useSearchParams()
15241524
let containerRef = React.useRef(Nullable.null)
15251525
let editorRef: React.ref<option<CodeMirror.editorInstance>> = React.useRef(None)
1526+
let (_, setScrollLock) = ScrollLockContext.useScrollLock()
1527+
1528+
React.useEffect(() => {
1529+
setScrollLock(_ => true)
1530+
None
1531+
}, [])
15261532

15271533
let versions =
15281534
versions
@@ -1990,7 +1996,7 @@ let make = (~bundleBaseUrl: string, ~versions: array<string>) => {
19901996
<button key={Int.toString(i)} onClick className disabled> {title} </button>
19911997
})
19921998

1993-
<main className={"flex flex-col bg-gray-100 text-gray-40 text-14 overflow-scroll mt-16"}>
1999+
<main className={"flex flex-col bg-gray-100 text-gray-40 text-14 mt-16"}>
19942000
<ControlPanel
19952001
actionIndicatorKey={Int.toString(actionCount)}
19962002
state=compilerState
@@ -2005,9 +2011,9 @@ let make = (~bundleBaseUrl: string, ~versions: array<string>) => {
20052011
// Left Panel
20062012
<div
20072013
ref={ReactDOM.Ref.domRef((Obj.magic(leftPanelRef): React.ref<Nullable.t<Dom.element>>))}
2008-
className={`overflow-scroll ${layout == Column ? "h-2/4" : "h-full!"} ${layout == Column
2009-
? "w-full"
2010-
: "w-[50%]"}`}
2014+
className={`overflow-scroll playground-scrollbar ${layout == Column
2015+
? "h-2/4"
2016+
: "h-full!"} ${layout == Column ? "w-full" : "w-[50%]"}`}
20112017
>
20122018
<div
20132019
className="bg-gray-100 h-full"
@@ -2042,7 +2048,7 @@ let make = (~bundleBaseUrl: string, ~versions: array<string>) => {
20422048
</div>
20432049
<div
20442050
ref={ReactDOM.Ref.domRef((Obj.magic(subPanelRef): React.ref<Nullable.t<Dom.element>>))}
2045-
className="overflow-auto"
2051+
className="overflow-auto playground-scrollbar"
20462052
>
20472053
<OutputPanel
20482054
currentTab compilerDispatch compilerState editorCode keyMapState={(keyMap, setKeyMap)}

styles/main.css

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,31 @@
295295
/* Chrome/Safari/Webkit */
296296
}
297297

298+
.playground-scrollbar {
299+
scrollbar-width: thin;
300+
scrollbar-color: var(--color-gray-70) var(--color-gray-100);
301+
scrollbar-gutter: stable; /* Reserve only at the scrollbar edge to avoid padding shifts */
302+
}
303+
304+
.playground-scrollbar::-webkit-scrollbar {
305+
width: 0.65rem;
306+
height: 0.65rem;
307+
}
308+
309+
.playground-scrollbar::-webkit-scrollbar-track {
310+
background: var(--color-gray-100);
311+
}
312+
313+
.playground-scrollbar::-webkit-scrollbar-thumb {
314+
background-color: var(--color-gray-70);
315+
border-radius: 9999px;
316+
border: 2px solid var(--color-gray-100);
317+
}
318+
319+
.playground-scrollbar::-webkit-scrollbar-thumb:hover {
320+
background-color: var(--color-gray-60);
321+
}
322+
298323
a > code {
299324
@apply text-fire;
300325
}

0 commit comments

Comments
 (0)