import { Elena, html, unsafeHTML } from '@elenajs/core'; /** * * Renders as an when `href` is set, otherwise a
. * Rotating accent color per nth-card via CSS counter. * */ export class LitroCard extends Elena(HTMLElement) { static tagName = 'litro-card'; static props = ['title', 'description', 'icon', 'iconsrc', 'href']; title = ''; description = ''; icon = ''; iconsrc = ''; href = ''; render() { const iconHtml = this.iconsrc ? `` : this.icon ? `${this.icon}` : ''; const descHtml = this.description ? `

${this.description}

` : ''; const inner = `
${iconHtml}

${this.title}

${descHtml} ${this.innerHTML ? `
${this.innerHTML}
` : ''} `; const tag = this.href ? 'a' : 'div'; const hrefAttr = this.href ? ` href="${this.href}"` : ''; return html` ${unsafeHTML(`<${tag} class="card"${hrefAttr}>${inner}`)} `; } } LitroCard.define(); export default LitroCard;