버튼 수정

This commit is contained in:
kjs
2025-11-04 11:41:20 +09:00
parent 7aecae559b
commit d64ca5a8c0
7 changed files with 256 additions and 133 deletions
@@ -235,17 +235,32 @@ export const RealtimePreviewDynamic: React.FC<RealtimePreviewProps> = ({
return `${size?.height || 40}px`;
};
// 버튼 컴포넌트인지 확인
const isButtonComponent =
(component.type === "widget" && (component as WidgetComponent).widgetType === "button") ||
(component.type === "component" && (component as any).componentType?.includes("button"));
// 버튼일 경우 로그 출력 (편집기)
if (isButtonComponent && isDesignMode) {
console.log("🎨 [편집기] 버튼 위치:", {
label: component.label,
positionX: position.x,
positionY: position.y,
sizeWidth: size?.width,
sizeHeight: size?.height,
});
}
const baseStyle = {
left: `${position.x}px`,
top: `${position.y}px`,
// 🆕 left가 0이면 부모 너비를 100% 채우도록 수정 (우측 여백)
width: position.x === 0 ? "100%" : getWidth(),
height: getHeight(), // 모든 컴포넌트 고정 높이로 변경
zIndex: component.type === "layout" ? 1 : position.z || 2, // 레이아웃은 z-index 1, 다른 컴포넌트는 2 이상
// x=0인 컴포넌트는 전체 너비 사용 (버튼)
width: (position.x === 0 && !isButtonComponent) ? "100%" : getWidth(),
height: getHeight(),
zIndex: component.type === "layout" ? 1 : position.z || 2,
...componentStyle,
// style.width가 있어도 position.x === 0이면 100%로 강제
...(position.x === 0 && { width: "100%" }),
// right 속성 강제 제거
// x=0인 컴포넌트는 100% 너비 강제 (버튼 제외)
...(position.x === 0 && !isButtonComponent && { width: "100%" }),
right: undefined,
};