import { $ } from '@oplayer/core' import { UIInterface } from '../types' import { progress, userName, time, description, tag } from './Title.style' const render = (it: UIInterface, el: HTMLElement) => { const { config } = it if(!config.title) return const renderTags = (tags: {name: string, url: string}[]) => { let tagsDomStr = "" tags.forEach((item) => { tagsDomStr += `#${item.name}` }) return tagsDomStr } const $dom = $.create( `div.${progress}`, {}, `
@${config.title.userName} ยท ${config.title.time}
${ config.title.description && `
${config.title.description} ${config.title.tags ? renderTags(config.title.tags) : ''}
` } ` ) $.render($dom, el) } export default render