/
card-sub-title.js
35 lines (31 loc) · 1002 Bytes
/
card-sub-title.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import { defineComponent, mergeData } from '../../vue'
import { NAME_CARD_SUB_TITLE } from '../../constants/components'
import { PROP_TYPE_STRING } from '../../constants/props'
import { makeProp, makePropsConfigurable } from '../../utils/props'
import { toString } from '../../utils/string'
// --- Props ---
export const props = makePropsConfigurable(
{
subTitle: makeProp(PROP_TYPE_STRING),
subTitleTag: makeProp(PROP_TYPE_STRING, 'h6'),
subTitleTextVariant: makeProp(PROP_TYPE_STRING, 'muted')
},
NAME_CARD_SUB_TITLE
)
// --- Main component ---
// @vue/component
export const BCardSubTitle = /*#__PURE__*/ defineComponent({
name: NAME_CARD_SUB_TITLE,
functional: true,
props,
render(h, { props, data, children }) {
return h(
props.subTitleTag,
mergeData(data, {
staticClass: 'card-subtitle',
class: [props.subTitleTextVariant ? `text-${props.subTitleTextVariant}` : null]
}),
children || toString(props.subTitle)
)
}
})