From 4fe023a81365355fc499baa3fcc7a2d8ba38d1ef Mon Sep 17 00:00:00 2001 From: kmh Date: Fri, 13 Mar 2026 11:29:32 +0900 Subject: [PATCH] feat: enhance column width configuration and rendering - Updated the column width handling in various components to support percentage-based widths, improving layout flexibility. - Adjusted input fields to enforce minimum and maximum width constraints, ensuring better user experience and preventing layout issues. - Enhanced the SortableColumnRow and related components to dynamically display width units, allowing for clearer configuration options. Made-with: Cursor --- .../screen/ResponsiveGridRenderer.tsx | 42 +++++++++++++++- .../V2SplitPanelLayoutConfigPanel.tsx | 7 ++- .../split-panel-layout2/ColumnConfigModal.tsx | 8 +-- .../SplitPanelLayout2Component.tsx | 4 +- .../SplitPanelLayoutComponent.tsx | 50 +++++++++++++------ .../SplitPanelLayoutConfigPanel.tsx | 19 ++++--- .../config-panels/LeftPanelConfigTab.tsx | 6 ++- .../config-panels/RightPanelConfigTab.tsx | 5 +- .../config-panels/SharedComponents.tsx | 10 ++-- 9 files changed, 111 insertions(+), 40 deletions(-) diff --git a/frontend/components/screen/ResponsiveGridRenderer.tsx b/frontend/components/screen/ResponsiveGridRenderer.tsx index 00e0dc53..c718c70e 100644 --- a/frontend/components/screen/ResponsiveGridRenderer.tsx +++ b/frontend/components/screen/ResponsiveGridRenderer.tsx @@ -370,7 +370,46 @@ export function ResponsiveGridRenderer({ const { normalComps } = processedRow; const allButtons = normalComps.every((c) => isButtonComponent(c)); - const gap = isMobile ? 8 : allButtons ? 8 : getRowGap(normalComps, canvasWidth); + + // 데스크톱에서 버튼만 있는 행: 디자이너의 x, width를 비율로 적용 + if (allButtons && normalComps.length > 0 && !isMobile) { + const rowHeight = Math.max(...normalComps.map(c => c.size?.height || 40)); + + return ( +
0 ? `${rowMarginTop}px` : undefined, + }} + > + {normalComps.map((component) => { + const typeId = getComponentTypeId(component); + const leftPct = (component.position.x / canvasWidth) * 100; + const widthPct = ((component.size?.width || 90) / canvasWidth) * 100; + + return ( +
+ {renderComponent(component)} +
+ ); + })} +
+ ); + } + + const gap = isMobile ? 8 : getRowGap(normalComps, canvasWidth); const hasFlexHeightComp = normalComps.some((c) => { const h = c.size?.height || 0; @@ -382,7 +421,6 @@ export function ResponsiveGridRenderer({ key={`row-${rowIndex}`} className={cn( "flex w-full flex-wrap overflow-hidden", - allButtons && "justify-end px-2 py-1", hasFlexHeightComp ? "min-h-0 flex-1" : "flex-shrink-0" )} style={{ gap: `${gap}px`, marginTop: rowMarginTop > 0 ? `${rowMarginTop}px` : undefined }} diff --git a/frontend/components/v2/config-panels/V2SplitPanelLayoutConfigPanel.tsx b/frontend/components/v2/config-panels/V2SplitPanelLayoutConfigPanel.tsx index a490d6b6..ae5679b6 100644 --- a/frontend/components/v2/config-panels/V2SplitPanelLayoutConfigPanel.tsx +++ b/frontend/components/v2/config-panels/V2SplitPanelLayoutConfigPanel.tsx @@ -157,10 +157,13 @@ function SortableColumnRow({ /> onWidthChange(parseInt(e.target.value) || 100)} - placeholder="너비" + onChange={(e) => onWidthChange(parseInt(e.target.value) || 20)} + placeholder="20" className="h-6 w-14 shrink-0 text-xs" + min={5} + max={100} /> + % {isNumeric && (