feat(create): wizard uploads render as images in display and exports (imageUrl/fileUrl)
This commit is contained in:
@@ -1,7 +1,12 @@
|
||||
/** Labeled paragraph group (Figma “Text” stacks under Membership / Decision-making, etc.). */
|
||||
export interface CommunityRuleLabeledBlock {
|
||||
label: string;
|
||||
/** With {@link imageUrl}, optional caption paragraphs only (not the uploaded file name). */
|
||||
body: string;
|
||||
/** Image URL (e.g. custom method upload). Rendered as `<img>` when set. */
|
||||
imageUrl?: string;
|
||||
/** Non-image attachment URL. Rendered as a link when set and {@link imageUrl} is absent. */
|
||||
fileUrl?: string;
|
||||
}
|
||||
|
||||
export interface CommunityRuleEntry {
|
||||
|
||||
@@ -54,12 +54,42 @@ function TextBlockView({
|
||||
<p className={`${ENTRY_TITLE_CLASS} w-full min-w-0`}>{title}</p>
|
||||
<div className="flex min-w-0 flex-col gap-3">
|
||||
{hasRows
|
||||
? rows!.map((row, i) => (
|
||||
<div key={i} className="flex min-w-0 flex-col gap-2">
|
||||
<p className={ROW_LABEL_CLASS}>{row.label}</p>
|
||||
<ParagraphGroup text={row.body} />
|
||||
</div>
|
||||
))
|
||||
? rows!.map((row, i) => {
|
||||
const imageSrc = row.imageUrl?.trim();
|
||||
const fileHref = row.fileUrl?.trim();
|
||||
const caption = row.body.trim();
|
||||
return (
|
||||
<div key={i} className="flex min-w-0 flex-col gap-2">
|
||||
<p className={ROW_LABEL_CLASS}>{row.label}</p>
|
||||
{imageSrc ? (
|
||||
<>
|
||||
{/* eslint-disable-next-line @next/next/no-img-element -- same-origin or absolute upload URL */}
|
||||
<img
|
||||
src={imageSrc}
|
||||
alt={caption.length > 0 ? caption : row.label}
|
||||
className="max-h-[240px] max-w-full rounded-[var(--measures-radius-200,8px)] object-contain"
|
||||
/>
|
||||
{caption.length > 0 ? (
|
||||
<ParagraphGroup text={row.body} />
|
||||
) : null}
|
||||
</>
|
||||
) : fileHref ? (
|
||||
<p className={`${PARAGRAPH_CLASS} whitespace-pre-wrap`}>
|
||||
<a
|
||||
href={fileHref}
|
||||
className="underline"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
{caption.length > 0 ? caption : fileHref}
|
||||
</a>
|
||||
</p>
|
||||
) : (
|
||||
<ParagraphGroup text={row.body} />
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
})
|
||||
: body.trim().length > 0 && <ParagraphGroup text={body} />}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user