Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions website/src/sandbox/Sandbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,10 @@ interface SandboxProps {

// Minimum heights for editor and results panes (in pixels)
const MIN_EDITOR_HEIGHT = 100;
const MIN_RESULTS_HEIGHT = 60;
// Results panel needs enough height to show the tab bar and remain draggable
const MIN_RESULTS_HEIGHT = 120;
// Height of the resize handle between editor and results
const RESIZE_HANDLE_HEIGHT = 6;

export default function Sandbox({
sampleFilename,
Expand Down Expand Up @@ -381,7 +384,9 @@ export default function Sandbox({
if (newContainerHeight > 0 && editorHeight !== null) {
// Clamp the editor height to stay within valid bounds
const maxEditorHeight =
newContainerHeight - MIN_RESULTS_HEIGHT;
newContainerHeight -
MIN_RESULTS_HEIGHT -
RESIZE_HANDLE_HEIGHT;
const clampedHeight = Math.max(
MIN_EDITOR_HEIGHT,
Math.min(editorHeight, maxEditorHeight)
Expand Down Expand Up @@ -412,8 +417,9 @@ export default function Sandbox({
const mouseY = e.clientY;
const newEditorHeight = mouseY - containerTop;

// Enforce minimum heights
const maxEditorHeight = containerHeight - MIN_RESULTS_HEIGHT;
// Enforce minimum heights (accounting for resize handle between editor and results)
const maxEditorHeight =
containerHeight - MIN_RESULTS_HEIGHT - RESIZE_HANDLE_HEIGHT;
const clampedEditorHeight = Math.max(
MIN_EDITOR_HEIGHT,
Math.min(newEditorHeight, maxEditorHeight)
Expand Down Expand Up @@ -1450,6 +1456,9 @@ const styles = stylex.create({
display: 'flex',
flexDirection: 'column',
flex: 1,
height: '100vh', // Fixed viewport height to prevent container from growing infinitely
maxHeight: '100vh',
overflow: 'hidden',
},
sandboxPadding: {
paddingHorizontal: '10px',
Expand Down Expand Up @@ -1624,6 +1633,7 @@ const styles = stylex.create({
flexDirection: 'column',
flex: 1,
minHeight: 0, // Allow flex children to shrink below content size
overflow: 'hidden', // Prevent content from pushing container beyond viewport
},
// Draggable resize handle between editor and results
resizeHandle: {
Expand Down
Loading