import React from "react"; import * as std from "../../law/std"; import { assertNever } from "../../util"; import type { HTMLComponentProps } from "../common/html"; import { elProps, wrapHTMLComponent } from "../common/html"; import { DOCXSentenceChildrenRun, HTMLSentenceChildrenRun } from "./sentenceChildrenRun"; import type { DOCXComponentProps } from "../common/docx/component"; import { wrapDOCXComponent } from "../common/docx/component"; import { w } from "../common/docx/tags"; import { DOCXParagraphItem, HTMLParagraphItem } from "./paragraphItem"; import { withKey } from "../common"; export interface RemarksProps { el: std.Remarks, indent: number, } export const HTMLRemarksCSS = /*css*/` .remarks { clear: both; } .remarks-label { clear: both; font-weight: bold; } `; export const HTMLRemarks = wrapHTMLComponent("HTMLRemarks", ((props: HTMLComponentProps & RemarksProps) => { const { el, htmlOptions, indent } = props; const blocks: React.JSX.Element[] = []; const RemarksLabel = el.children.find(std.isRemarksLabel); if (RemarksLabel) { blocks.push((
)); } const bodyBlocks: React.JSX.Element[] = []; for (const child of el.children) { if ( std.isRemarksLabel(child) ) { continue; } else if (std.isSentence(child)) { bodyBlocks.push((
)); } else if (std.isItem(child)) { bodyBlocks.push(( )); } else { assertNever(child); } } if (bodyBlocks.length > 0) { blocks.push((
{withKey(bodyBlocks)}
)); } return (
{withKey(blocks)}
); })); export const DOCXRemarks = wrapDOCXComponent("DOCXRemarks", ((props: DOCXComponentProps & RemarksProps) => { const { el, docxOptions, indent } = props; const blocks: React.JSX.Element[] = []; const RemarksLabel = el.children.find(std.isRemarksLabel); if (RemarksLabel) { blocks.push(( )); } for (const child of el.children) { if ( std.isRemarksLabel(child) ) { continue; } else if (std.isSentence(child)) { blocks.push(( )); } else if (std.isItem(child)) { blocks.push(); } else { assertNever(child); } } return (<> {withKey(blocks)} ); }));