feat: complete TASK-WP4-04 color and dynamic stickers

This commit is contained in:
suyx
2026-08-03 14:11:40 +08:00
parent dd7a23a281
commit 457e1147e4
29 changed files with 2234 additions and 61 deletions
+14
View File
@@ -0,0 +1,14 @@
import { useEffect, useState } from "react";
import type { CanvasState } from "@dada/shared-contracts";
type CanvasElement = CanvasState["elements"][number];
export function DynamicInspector(props: { element: CanvasElement; onCommit: (value: string) => void }) {
const [value, setValue] = useState(props.element.formatted_value ?? "");
useEffect(() => setValue(props.element.formatted_value ?? ""), [props.element.element_id, props.element.formatted_value]);
return <section className="editor-dynamic-inspector">
{props.element.template_or_asset_id === "DYN012" ? <p className="editor-font-substitution" role="note"> DIN_MediumAlternate.otf 使 FONT081 · Lexend Deca </p> : null}
<label><textarea aria-label="动态贴纸显示文字" onChange={(event) => setValue(event.target.value)} value={value} /></label>
<button className="editor-wide-command" disabled={!value.trim() || value === props.element.formatted_value} onClick={() => props.onCommit(value)} type="button"></button>
</section>;
}