diff --git a/apps/web/src/pages/editing-planner/components/sticker/StickerPreview.tsx b/apps/web/src/pages/editing-planner/components/sticker/StickerPreview.tsx new file mode 100755 index 000000000..d14132b24 --- /dev/null +++ b/apps/web/src/pages/editing-planner/components/sticker/StickerPreview.tsx @@ -0,0 +1,39 @@ +import React from "react" +import type { StickerItem } from "@/pages/editing-planner/types" +import { TEXT_PRESET_STYLES } from "@/pages/editing-planner/constants/sticker" + +interface StickerPreviewProps { + sticker: StickerItem +} + +export const StickerPreview: React.FC = ({ sticker }) => ( +
+
+ {sticker.type === "emoji" && sticker.content} + {sticker.type === "text" && sticker.content} + {sticker.type === "image" && ( + sticker + )} +
+
+) diff --git a/apps/web/src/pages/editing-planner/components/sticker/StickerPropsEditor.tsx b/apps/web/src/pages/editing-planner/components/sticker/StickerPropsEditor.tsx old mode 100644 new mode 100755 index 4612d6476..871b401ff --- a/apps/web/src/pages/editing-planner/components/sticker/StickerPropsEditor.tsx +++ b/apps/web/src/pages/editing-planner/components/sticker/StickerPropsEditor.tsx @@ -2,11 +2,9 @@ * 选中贴纸的属性编辑器 */ import React from "react" -import type { StickerItem, TextStickerPreset } from "@/pages/editing-planner/types" -import { - TEXT_PRESET_STYLES, - TEXT_STICKER_PRESET_LABELS, -} from "@/pages/editing-planner/constants/sticker" +import type { StickerItem } from "@/pages/editing-planner/types" +import { StickerPreview } from "./StickerPreview" +import { TextStickerPropsEditor } from "./TextStickerPropsEditor" interface StickerPropsEditorProps { sticker: StickerItem @@ -121,78 +119,10 @@ const StickerPropsEditor: React.FC = ({ {/* 文字贴纸特有属性 */} - {sticker.type === "text" && ( - <> -
- 花字 - -
-
- 字号 - onUpdate(sticker.id, { font_size: Number(e.target.value) })} - /> - {sticker.font_size}px -
-
- 颜色 - onUpdate(sticker.id, { text_color: e.target.value })} - /> -
- - )} + {/* 预览 */} -
-
- {sticker.type === "emoji" && sticker.content} - {sticker.type === "text" && sticker.content} - {sticker.type === "image" && ( - sticker - )} -
-
+ ) } diff --git a/apps/web/src/pages/editing-planner/components/sticker/TextStickerPropsEditor.tsx b/apps/web/src/pages/editing-planner/components/sticker/TextStickerPropsEditor.tsx new file mode 100755 index 000000000..2dd8bdebe --- /dev/null +++ b/apps/web/src/pages/editing-planner/components/sticker/TextStickerPropsEditor.tsx @@ -0,0 +1,57 @@ +import React from "react" +import type { StickerItem, TextStickerPreset } from "@/pages/editing-planner/types" +import { TEXT_STICKER_PRESET_LABELS } from "@/pages/editing-planner/constants/sticker" + +interface TextStickerPropsEditorProps { + sticker: StickerItem + onUpdate: (id: string, partial: Partial) => void +} + +export const TextStickerPropsEditor: React.FC = ({ + sticker, + onUpdate, +}) => { + if (sticker.type !== "text") return null + + return ( + <> +
+ 花字 + +
+
+ 字号 + onUpdate(sticker.id, { font_size: Number(e.target.value) })} + /> + {sticker.font_size}px +
+
+ 颜色 + onUpdate(sticker.id, { text_color: e.target.value })} + /> +
+ + ) +} diff --git a/apps/web/src/test/pages/editing-planner/smoke.test.tsx b/apps/web/src/test/pages/editing-planner/smoke.test.tsx old mode 100644 new mode 100755 index c4d3f267c..76557af8b --- a/apps/web/src/test/pages/editing-planner/smoke.test.tsx +++ b/apps/web/src/test/pages/editing-planner/smoke.test.tsx @@ -61,6 +61,8 @@ import "@/pages/editing-planner/components/pip-config/LayerConfig" import "@/pages/editing-planner/components/sticker/StickerLibrary" import "@/pages/editing-planner/components/sticker/StickerList" import "@/pages/editing-planner/components/sticker/StickerPropsEditor" +import "@/pages/editing-planner/components/sticker/StickerPreview" +import "@/pages/editing-planner/components/sticker/TextStickerPropsEditor" import "@/pages/editing-planner/components/filter/FilterPresetGrid" import "@/pages/editing-planner/components/filter/FilterManualAdjust" import "@/pages/editing-planner/components/intro-outro/IntroOutroBlock"