= ({
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,
};
diff --git a/frontend/components/screen/ScreenList.tsx b/frontend/components/screen/ScreenList.tsx
index bcb22291..e0e9111f 100644
--- a/frontend/components/screen/ScreenList.tsx
+++ b/frontend/components/screen/ScreenList.tsx
@@ -1250,14 +1250,33 @@ export default function ScreenList({ onScreenSelect, selectedScreen, onDesignScr
{/* ์ค์ ์ปดํฌ๋ํธ */}
{
+ const style = {
+ position: "absolute" as const,
+ left: `${component.position.x}px`,
+ top: `${component.position.y}px`,
+ width: component.style?.width || `${component.size.width}px`,
+ height: component.style?.height || `${component.size.height}px`,
+ zIndex: component.position.z || 1,
+ };
+
+ // ๋ฒํผ ํ์
์ผ ๋ ๋๋ฒ๊น
(widget ํ์
๋๋ component ํ์
๋ชจ๋ ์ฒดํฌ)
+ if (
+ (component.type === "widget" && (component as any).widgetType === "button") ||
+ (component.type === "component" && (component as any).componentType?.includes("button"))
+ ) {
+ console.log("๐ ScreenList ๋ฒํผ ์ธ๋ถ div ์คํ์ผ:", {
+ id: component.id,
+ label: component.label,
+ position: component.position,
+ size: component.size,
+ componentStyle: component.style,
+ appliedStyle: style,
+ });
+ }
+
+ return style;
+ })()}
>
{/* ์์ ฏ ์ปดํฌ๋ํธ๊ฐ ์๋ ๊ฒฝ์ฐ DynamicComponentRenderer ์ฌ์ฉ */}
{component.type !== "widget" ? (
diff --git a/frontend/components/screen/widgets/types/ButtonWidget.tsx b/frontend/components/screen/widgets/types/ButtonWidget.tsx
index 0fc7ad45..6bc9e1ff 100644
--- a/frontend/components/screen/widgets/types/ButtonWidget.tsx
+++ b/frontend/components/screen/widgets/types/ButtonWidget.tsx
@@ -31,7 +31,11 @@ export const ButtonWidget: React.FC = ({
onClick={handleClick}
disabled={disabled || readonly}
className={`rounded-md bg-blue-600 px-4 py-2 text-sm font-medium text-white transition-colors duration-200 hover:bg-blue-700 focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 focus:outline-none disabled:cursor-not-allowed disabled:bg-gray-300 disabled:text-gray-500 ${className || ""} `}
- style={style}
+ style={{
+ ...style,
+ width: "100%",
+ height: "100%",
+ }}
title={config?.tooltip || placeholder}
>
{config?.label || config?.text || value || placeholder || "๋ฒํผ"}
diff --git a/frontend/lib/registry/DynamicWebTypeRenderer.tsx b/frontend/lib/registry/DynamicWebTypeRenderer.tsx
index b2578648..bccb9f50 100644
--- a/frontend/lib/registry/DynamicWebTypeRenderer.tsx
+++ b/frontend/lib/registry/DynamicWebTypeRenderer.tsx
@@ -21,12 +21,16 @@ export const DynamicWebTypeRenderer: React.FC = ({
const { webTypes } = useWebTypes({ active: "Y" });
// ๋๋ฒ๊น
: ์ ๋ฌ๋ฐ์ ์นํ์
๊ณผ props ์ ๋ณด ๋ก๊น
- console.log("๐ DynamicWebTypeRenderer ํธ์ถ:", {
- webType,
- propsKeys: Object.keys(props),
- component: props.component,
- isFileComponent: props.component?.type === "file" || webType === "file",
- });
+ if (webType === "button") {
+ console.log("๐ DynamicWebTypeRenderer ๋ฒํผ ํธ์ถ:", {
+ webType,
+ component: props.component,
+ position: props.component?.position,
+ size: props.component?.size,
+ style: props.component?.style,
+ config,
+ });
+ }
const webTypeDefinition = useMemo(() => {
return WebTypeRegistry.getWebType(webType);