Skip to content

Commit 8f466aa

Browse files
authored
fix: eliminate horizontal overflow from cell negative margins (#112)
- Remove -mx-3 negative margins from all cell types (Cell, AiCell, SqlCell) - Standardize cell padding to use consistent px-4 across mobile and desktop - Fix output area padding for better content alignment - Eliminates subtle horizontal scroll that appeared when cells were present - All tests passing (52/52), no functional changes
1 parent 45d9bf6 commit 8f466aa

File tree

3 files changed

+9
-12
lines changed

3 files changed

+9
-12
lines changed

src/components/notebook/AiCell.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ export const AiCell: React.FC<AiCellProps> = ({
288288

289289
return (
290290
<div
291-
className={`cell-container group relative -mx-3 mb-2 px-3 pt-2 transition-all duration-200 sm:mx-0 sm:mb-3 sm:px-0 ${
291+
className={`cell-container group relative mb-2 pt-2 transition-all duration-200 sm:mb-3 ${
292292
autoFocus && !contextSelectionMode
293293
? "bg-purple-50/30"
294294
: "hover:bg-muted/10"
@@ -556,7 +556,7 @@ export const AiCell: React.FC<AiCellProps> = ({
556556
{/* Text Content Area - Chat-like on mobile */}
557557
{cell.sourceVisible && (
558558
<div
559-
className={`cell-content py-1 pr-1 pl-4 transition-colors sm:pr-4 ${
559+
className={`cell-content px-4 py-1 transition-colors sm:px-4 ${
560560
autoFocus ? "bg-white" : "bg-white"
561561
}`}
562562
>
@@ -700,7 +700,7 @@ export const AiCell: React.FC<AiCellProps> = ({
700700

701701
{/* Output Area for AI Responses */}
702702
{outputs.length > 0 && cell.outputVisible && (
703-
<div className="cell-content bg-background mt-1 max-w-full overflow-hidden pr-1 pl-6 sm:pr-4">
703+
<div className="cell-content bg-background mt-1 max-w-full overflow-hidden px-4 sm:px-4">
704704
{groupConsecutiveStreamOutputs(
705705
outputs.sort(
706706
(a: OutputData, b: OutputData) => a.position - b.position

src/components/notebook/Cell.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ export const Cell: React.FC<CellProps> = ({
298298

299299
return (
300300
<div
301-
className={`cell-container group relative -mx-3 mb-2 px-3 pt-2 transition-all duration-200 sm:mx-0 sm:mb-3 sm:px-0 ${
301+
className={`cell-container group relative mb-2 pt-2 transition-all duration-200 sm:mb-3 ${
302302
autoFocus && !contextSelectionMode
303303
? "bg-primary/5"
304304
: "hover:bg-muted/10"
@@ -309,9 +309,6 @@ export const Cell: React.FC<CellProps> = ({
309309
: "bg-gray-50/30 ring-2 ring-gray-300"
310310
: ""
311311
}`}
312-
style={{
313-
position: "relative",
314-
}}
315312
>
316313
{/* Custom left border with controlled height */}
317314
<div
@@ -526,7 +523,7 @@ export const Cell: React.FC<CellProps> = ({
526523
{/* Text Content Area */}
527524
{cell.sourceVisible && (
528525
<div
529-
className={`cell-content py-1 pr-1 pl-4 transition-colors sm:pr-4 ${
526+
className={`cell-content px-4 py-1 transition-colors sm:px-4 ${
530527
autoFocus ? "bg-white" : "bg-white"
531528
}`}
532529
>
@@ -640,7 +637,7 @@ export const Cell: React.FC<CellProps> = ({
640637
{cell.cellType === "code" &&
641638
cell.outputVisible &&
642639
(outputs.length > 0 || cell.executionState === "running") && (
643-
<div className="cell-content bg-background mt-1 max-w-full overflow-hidden pr-1 pl-6 sm:pr-4">
640+
<div className="cell-content bg-background mt-1 max-w-full overflow-hidden px-4 sm:px-4">
644641
{cell.executionState === "running" && outputs.length === 0 && (
645642
<div className="border-l-2 border-blue-200 py-3 pl-1">
646643
<div className="flex items-center gap-2">

src/components/notebook/SqlCell.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ export const SqlCell: React.FC<SqlCellProps> = ({
254254

255255
return (
256256
<div
257-
className={`cell-container group relative -mx-3 mb-2 px-3 pt-2 transition-all duration-200 sm:mx-0 sm:mb-3 sm:px-0 ${
257+
className={`cell-container group relative mb-2 pt-2 transition-all duration-200 sm:mb-3 ${
258258
autoFocus && !contextSelectionMode
259259
? "bg-blue-50/30"
260260
: "hover:bg-muted/10"
@@ -482,7 +482,7 @@ export const SqlCell: React.FC<SqlCellProps> = ({
482482
{/* Text Content Area */}
483483
{cell.sourceVisible && (
484484
<div
485-
className={`cell-content py-1 pr-1 pl-4 transition-colors sm:pr-4 ${
485+
className={`cell-content px-4 py-1 transition-colors sm:px-4 ${
486486
autoFocus ? "bg-white" : "bg-white"
487487
}`}
488488
>
@@ -552,7 +552,7 @@ export const SqlCell: React.FC<SqlCellProps> = ({
552552

553553
{/* Query Results */}
554554
{cell.sqlResultData && cell.outputVisible && (
555-
<div className="cell-content bg-background mt-1 max-w-full overflow-hidden pr-1 pl-6 sm:pr-4">
555+
<div className="cell-content bg-background mt-1 max-w-full overflow-hidden px-4 sm:px-4">
556556
{renderResults()}
557557
</div>
558558
)}

0 commit comments

Comments
 (0)