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 { DOCXColumnsOrSentencesRun, HTMLColumnsOrSentencesRun } from "./columnsOrSentencesRun"; import type { DOCXComponentProps } from "../common/docx/component"; import { wrapDOCXComponent } from "../common/docx/component"; import { w } from "../common/docx/tags"; import { withKey } from "../common"; export interface ListProps { el: std.ListOrSublist, indent: number, } export const HTMLListCSS = /*css*/` .list-main { } `; export const HTMLList = wrapHTMLComponent("HTMLList", ((props: HTMLComponentProps & ListProps) => { const { el, htmlOptions, indent } = props; const blocks: React.JSX.Element[] = []; for (const child of el.children) { if (std.isListOrSublistSentence(child)) { blocks.push((
)); } else if (std.isListOrSublist(child)) { blocks.push(); } else { throw assertNever(child); } } return (
{withKey(blocks)}
); })); export const DOCXList = wrapDOCXComponent("DOCXList", ((props: DOCXComponentProps & ListProps) => { const { el, docxOptions, indent } = props; const blocks: React.JSX.Element[] = []; for (const child of el.children) { if (std.isListOrSublistSentence(child)) { blocks.push(( )); } else if (std.isListOrSublist(child)) { blocks.push(); } else { throw assertNever(child); } } return ( <> {withKey(blocks)} ); }));