import type { CSSProperties } from "react"; import type { CertificateTemplateComponentProps } from "@/lib/certificate"; import { TemplateShell } from "@/templates/template-primitives"; const width = 1576; const height = 1080; const backgroundSrc = "/lobster-birth-tx-blank.png"; const fieldTextBaseStyle: CSSProperties = { position: "absolute", height: 50, paddingInline: 0, fontSize: 38, fontWeight: 500, lineHeight: "50px", color: "#202020", fontFamily: '"Microsoft YaHei", "PingFang SC", sans-serif', whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis", }; const fieldLayouts = { childName: { left: 470, top: 340, minWidth: 470 }, familyAddress: { left: 420, top: 420, minWidth: 470 }, parentName: { left: 420, top: 510, minWidth: 470 }, birthDate: { left: 420, top: 600, minWidth: 470 }, birthAddress: { left: 420, top: 690, minWidth: 470 }, } as const; function normalizeFieldValue(value: string) { return value.replace(/[\r\n]+/g, " ").replace(/\s+/g, " ").trim(); } function FieldText({ value, style, }: { value: string; style: CSSProperties; }) { const text = normalizeFieldValue(value); if (!text) { return null; } return