Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

fix: brodered grid on overflow (#1113)

Myles Scolnick919efffeec0c
diff --git a/frontend/src/components/editor/renderers/grid-layout/grid-layout.tsx b/frontend/src/components/editor/renderers/grid-layout/grid-layout.tsx
index dc271ab0e4..6e0400ce2d 100644
--- a/frontend/src/components/editor/renderers/grid-layout/grid-layout.tsx
+++ b/frontend/src/components/editor/renderers/grid-layout/grid-layout.tsx
@@ -134,7 +134,7 @@ export const GridLayoutRenderer: React.FC<Props> = ({
styles.backgroundSize = `calc((100% / ${layout.columns})) ${layout.rowHeight}px`;
}
- const grid = (
+ let grid = (
<ReactGridLayout
breakpoint="lg"
layouts={{
@@ -148,13 +148,11 @@ export const GridLayoutRenderer: React.FC<Props> = ({
// Show grid border and background when editing
enableInteractions && "bg-[var(--slate-2)] border-r",
// Disable animations and add padding when reading
- isReading && "disable-animation px-4 ",
- // Add border styles
- layout.bordered && "border-t border-x rounded-t shadow-sm",
- // Add additional padding if bordered when reading
- layout.bordered && isReading && "pt-4 w-[calc(100%-2rem)]",
+ isReading && "disable-animation",
!layout.maxWidth && "min-w-[800px]",
)}
+ // Add additional padding if bordered when reading
+ containerPadding={isReading ? [20, 20] : undefined}
margin={MARGIN}
isBounded={false}
compactType={null}
@@ -252,11 +250,34 @@ export const GridLayoutRenderer: React.FC<Props> = ({
);
if (isReading) {
+ if (layout.bordered) {
+ grid = (
+ <div className="flex flex-1 flex-col items-center">
+ <div
+ style={styles}
+ className="bg-background flex-1 border-t border-x rounded-t shadow-sm w-full overflow-hidden"
+ >
+ {grid}
+ </div>
+ </div>
+ );
+ }
return grid;
}
const notInGrid = cells.filter((cell) => !inGridIds.has(cell.id));
+ if (layout.bordered) {
+ grid = (
+ <div
+ style={styles}
+ className="bg-background border-t border-x rounded-t shadow-sm w-full mx-auto overflow-hidden mt-4"
+ >
+ {grid}
+ </div>
+ );
+ }
+
return (
<>
<GridControls
@@ -265,7 +286,7 @@ export const GridLayoutRenderer: React.FC<Props> = ({
isLocked={isLocked}
setIsLocked={setIsLocked}
/>
- <div className={cn("relative flex gap-2 px-2 z-10 flex-1")}>
+ <div className={cn("relative flex z-10 flex-1 overflow-hidden")}>
<div
className={cn(
"flex-grow overflow-auto transparent-when-disconnected",
@@ -273,7 +294,7 @@ export const GridLayoutRenderer: React.FC<Props> = ({
>
{grid}
</div>
- <div className="flex-none flex flex-col w-[300px] p-2 gap-2 overflow-auto h-full bg-[var(--slate-2)] border-t border-x rounded-t shadow-sm transparent-when-disconnected">
+ <div className="flex-none flex flex-col w-[300px] p-2 pb-20 gap-2 overflow-auto bg-[var(--slate-2)] border-t border-x rounded-t shadow-sm transparent-when-disconnected mx-2 mt-4">
<div className="text font-bold text-[var(--slate-20)] flex-shrink-0">
Outputs
</div>
@@ -382,7 +403,7 @@ const GridControls: React.FC<{
setIsLocked: (isLocked: boolean) => void;
}> = ({ layout, setLayout, isLocked, setIsLocked }) => {
return (
- <div className="flex flex-row absolute left-5 top-4 gap-4 w-full justify-end pr-[350px]">
+ <div className="flex flex-row absolute pl-5 top-8 gap-4 w-full justify-end pr-[350px] pb-3 border-b z-20">
<div className="flex flex-row items-center gap-2">
<Label htmlFor="columns">Columns</Label>
<NumberField
diff --git a/1072.py b/marimo/_smoke_tests/bugs/1072.py
similarity index 100%
rename from 1072.py
rename to marimo/_smoke_tests/bugs/1072.py