skeleton-icon.js
1.11 KB
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
36
37
38
39
40
41
42
43
44
45
import { extend, mergeData } from '../../vue'
import { NAME_SKELETON_ICON } from '../../constants/components'
import { PROP_TYPE_OBJECT, PROP_TYPE_STRING } from '../../constants/props'
import { makeProp, makePropsConfigurable } from '../../utils/props'
import { BIcon } from '../../icons'
// --- Props ---
export const props = makePropsConfigurable(
{
animation: makeProp(PROP_TYPE_STRING, 'wave'),
icon: makeProp(PROP_TYPE_STRING),
iconProps: makeProp(PROP_TYPE_OBJECT, {})
},
NAME_SKELETON_ICON
)
// --- Main component ---
// @vue/component
export const BSkeletonIcon = /*#__PURE__*/ extend({
name: NAME_SKELETON_ICON,
functional: true,
props,
render(h, { data, props }) {
const { icon, animation } = props
const $icon = h(BIcon, {
staticClass: 'b-skeleton-icon',
props: {
...props.iconProps,
icon
}
})
return h(
'div',
mergeData(data, {
staticClass: 'b-skeleton-icon-wrapper position-relative d-inline-block overflow-hidden',
class: { [`b-skeleton-animate-${animation}`]: animation }
}),
[$icon]
)
}
})