fix display of preview

This commit is contained in:
JzoNg 2026-01-12 15:55:52 +08:00
parent b6db6d9305
commit 7deaab116a
2 changed files with 5 additions and 11 deletions

View File

@ -62,10 +62,7 @@ const FormContentPreview: FC<FormContentPreviewProps> = ({
}
const placeholder = input.placeholder
return (
<Note
placeholder={placeholder!}
title={name}
/>
<Note placeholder={placeholder!} />
)
})(),
}}

View File

@ -123,14 +123,11 @@ export const Variable: React.FC<{ path: string }> = ({ path }) => {
)
}
export const Note: React.FC<{ placeholder: FormInputItemPlaceholder, title: string }> = ({ placeholder, title }) => {
export const Note: React.FC<{ placeholder: FormInputItemPlaceholder }> = ({ placeholder }) => {
const isVariable = placeholder.type === 'variable'
return (
<>
<h2>{title}</h2>
<div className="mt-3 rounded-[10px] bg-components-input-bg-normal px-2.5 py-2">
{isVariable ? <Variable path={`{{${placeholder.selector.join('.')}}}`} /> : <span>{placeholder.value}</span>}
</div>
</>
<div className="mt-3 rounded-[10px] bg-components-input-bg-normal px-2.5 py-2">
{isVariable ? <Variable path={`{{${placeholder.selector.join('.')}}}`} /> : <span>{placeholder.value}</span>}
</div>
)
}