import { html, nothing } from "lit-html"; import { FDocumentStatement, FDocumentViewer } from "./f-document-viewer"; export default function render(this: FDocumentViewer) { const renderedHTML = this.traverse(this.content, 0); return html` ${this.jumplinksSection()} ${this.contentSectionHeader()} ${renderedHTML} `; } export function jumplinksItems(this: FDocumentViewer) { // listing the sidebar items on the basis of json return Object.entries(this.content).map( ([key, value], index) => html` this.scrollToSectionMethod(key)} id="${this.sidebarRefName(key)}" .selected=${index === 0 ? "background" : "none"} width="300px" > ${ (value as FDocumentStatement).title || value } ` ); } export function jumplinksSection(this: FDocumentViewer) { return this.jumpLinks ? html` Sections ${this.jumplinksItems()} ${this.collapsibleJumpLinks ? html` ` : nothing}` : nothing; } export function contentSectionHeader(this: FDocumentViewer) { return html` ${this.levelSelector ? html` ` : nothing} `; }