import { IContentType } from '../../ContentTypes/ContentType.interface' import { BlockFactory } from '../Black.factory' import { Block } from '../Block' type TableRowContentType = { cells: any[] } export class TableRow extends Block { static tagRowName:string = 'tr' static tagName:string = 'td' toHTML(): string { const tableRowContent:TableRowContentType = this.content as TableRowContentType const classTag = ['notion', 'table_row'] const tableContents = tableRowContent.cells.map((rawListItem:any[]) => { return rawListItem.map(rawItem => { const item:IContentType = BlockFactory.transformWithType(rawItem) return `<${TableRow.tagName}>${item && item.toHTML ? item.toHTML() : 'UNKNOWN Content'}` }).join('') }) return `<${TableRow.tagRowName} class="${classTag.join(' ')}">${tableContents.join('')}` } }