diff --git a/src/app/editor/page.tsx b/src/app/editor/page.tsx index 47f976f..1b0c8a6 100644 --- a/src/app/editor/page.tsx +++ b/src/app/editor/page.tsx @@ -17,12 +17,21 @@ import { } from "@dnd-kit/sortable"; import { CSS } from "@dnd-kit/utilities"; import { useEditorStore } from "@/features/editor/state/editorStore"; -import type { Block } from "@/features/editor/state/editorStore"; +import type { + Block, + TextBlockProps, + ButtonBlockProps, + ImageBlockProps, + SectionBlockProps, +} from "@/features/editor/state/editorStore"; export default function EditorPage() { const blocks = useEditorStore((state) => state.blocks); const selectedBlockId = useEditorStore((state) => state.selectedBlockId); const addTextBlock = useEditorStore((state) => state.addTextBlock); + const addButtonBlock = useEditorStore((state) => state.addButtonBlock); + const addImageBlock = useEditorStore((state) => state.addImageBlock); + const addSectionBlock = useEditorStore((state) => state.addSectionBlock); const updateBlock = useEditorStore((state) => state.updateBlock); const selectBlock = useEditorStore((state) => state.selectBlock); const replaceBlocks = useEditorStore((state) => state.replaceBlocks); @@ -166,6 +175,27 @@ export default function EditorPage() { > 텍스트 블록 추가 + + +
Text / Image / Button / Section 블록을 이 영역에서 추가할 수 있습니다.
@@ -214,66 +244,189 @@ export default function EditorPage() {선택한 텍스트 블록 내용
-선택한 텍스트 블록 내용
+@@ -416,19 +569,36 @@ function SortableEditorBlock({ transition, }; - const alignClass = - block.props.align === "center" - ? "text-center" - : block.props.align === "right" - ? "text-right" - : "text-left"; + let alignClass = ""; + let sizeClass = ""; - const sizeClass = - block.props.size === "sm" - ? "text-sm" - : block.props.size === "lg" - ? "text-lg" - : "text-base"; + if (block.type === "text") { + const textProps = block.props as TextBlockProps; + alignClass = + textProps.align === "center" + ? "text-center" + : textProps.align === "right" + ? "text-right" + : "text-left"; + + sizeClass = + textProps.size === "sm" + ? "text-sm" + : textProps.size === "lg" + ? "text-lg" + : "text-base"; + } else if (block.type === "button") { + // 버튼 블록은 기본 텍스트 스타일만 적용 + alignClass = "text-left"; + sizeClass = "text-base"; + } else if (block.type === "image") { + alignClass = "text-left"; + sizeClass = "text-base"; + } else { + // 섹션 블록: 텍스트 크기 대신 섹션 자체에 패딩/배경을 입히므로 텍스트 클래스는 기본값만 + alignClass = "text-left"; + sizeClass = "text-base"; + } return (