fix(dialog): let the dialog's own padding decide its layout
DialogContent is a grid whose single implicit column is `auto`, so it sized to the widest child's min-content — and one row of the split editor (a select, an amount, a unit, a radio and a remove button) has a min-content width of 480px against the 464px the padding leaves. The column grew past the padding box and every stretched child grew with it, so measured, every field in the purchase dialog sat 6.6px from the right edge and 25px from the left. One crowded row was setting the padding for the whole dialog. `grid-cols-[minmax(0,1fr)]` lets the column shrink to the space actually available, which puts the element's own `p-6` back in charge. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5
parent
394c5f74df
commit
85ba899059
@@ -61,7 +61,17 @@ function DialogContent({
|
||||
<DialogPrimitive.Content
|
||||
data-slot="dialog-content"
|
||||
className={cn(
|
||||
"fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background p-6 shadow-lg duration-200 outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:max-w-lg",
|
||||
// `grid-cols-[minmax(0,1fr)]` is load-bearing, not tidying. This is a
|
||||
// grid whose single implicit column is `auto`, so it sizes to the
|
||||
// widest child's MIN-content — and one row of the split editor
|
||||
// (a select, an amount, a unit, a radio and a remove button) has a
|
||||
// min-content width of 480px. The column grew past the padding box,
|
||||
// every stretched child grew with it, and so every field in the
|
||||
// purchase dialog sat 17px from the right edge and 25px from the
|
||||
// left. `minmax(0, 1fr)` lets the column shrink to the space the
|
||||
// padding actually leaves, which puts this element's own padding
|
||||
// back in charge of the layout inside it.
|
||||
"fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] grid-cols-[minmax(0,1fr)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background p-6 shadow-lg duration-200 outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:max-w-lg",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
|
||||
Reference in New Issue
Block a user