import type { VNode } from 'vue'; import { Prop, toNative } from 'vue-facing-decorator'; import TsxComponent, { Component } from '../../app/vuetsx'; import VueUtils from '../../common/utils/vue-utils'; interface CardHeaderArgs { title?: string | VNode; subtitle?: string; smallTitle?: string; } @Component class CardHeaderComponent extends TsxComponent implements CardHeaderArgs { @Prop() title!: string | VNode; @Prop() subtitle!: string; @Prop() smallTitle?: string; render(h) { const titleIsVnode = VueUtils.isVNode(this.title); return (
{this.smallTitle &&
{this.smallTitle}
} {titleIsVnode && this.title &&
{this.title}
} {!titleIsVnode && this.title && (
{this.title} {this.subtitle != null && this.subtitle.length > 0 && ( {' '} - {this.subtitle} )}
)}
); } } const CardHeader = toNative(CardHeaderComponent); export default CardHeader;