1
1
<template >
2
- <b-card >
3
- <!-- TODO add possible blank Img? -->
4
- <!-- Problem is BCard doesn't have an option for blank imgs -->
2
+ <b-card :img-bottom =" imgBottomBoolean" >
3
+ <template v-if =" ! noImgBoolean " #img >
4
+ <slot name =" img" >
5
+ <b-card-img v-bind =" imgAttrs" />
6
+ </slot >
7
+ </template >
8
+
5
9
<template v-if =" ! noHeaderBoolean " #header >
6
10
<slot name =" header" >
7
11
<b-placeholder v-bind =" headerAttrs" />
26
30
27
31
<script setup lang="ts">
28
32
import BCard from ' ../BCard/BCard.vue'
33
+ import BCardImg from ' ../BCard/BCardImg.vue'
29
34
import BPlaceholder from ' ./BPlaceholder.vue'
30
35
import {Booleanish , ColorVariant } from ' ../../types'
31
36
import {computed , toRef } from ' vue'
@@ -37,17 +42,20 @@ interface Props {
37
42
headerVariant? : ColorVariant
38
43
headerAnimation? : ' glow' | ' wave'
39
44
headerSize? : ' xs' | ' sm' | ' lg'
40
-
41
45
noFooter? : Booleanish
42
46
footerWidth? : string | number
43
47
footerVariant? : ColorVariant
44
48
footerAnimation? : ' glow' | ' wave'
45
49
footerSize? : ' xs' | ' sm' | ' lg'
46
-
47
50
animation? : ' glow' | ' wave'
48
51
size? : ' xs' | ' sm' | ' lg'
49
52
variant? : ColorVariant
50
53
noButton? : Booleanish
54
+ imgBottom? : Booleanish
55
+ imgSrc? : string
56
+ imgBlankColor? : string
57
+ imgHeight? : string | number
58
+ noImg? : Booleanish
51
59
}
52
60
53
61
const props = withDefaults (defineProps <Props >(), {
@@ -56,11 +64,17 @@ const props = withDefaults(defineProps<Props>(), {
56
64
footerWidth: 100 ,
57
65
noHeader: false ,
58
66
noFooter: false ,
67
+ imgBlankColor: ' #868e96' ,
68
+ imgHeight: 100 ,
69
+ imgBottom: false ,
70
+ noImg: false ,
59
71
})
60
72
61
73
const noButtonBoolean = useBooleanish (toRef (props , ' noButton' ))
62
74
const noHeaderBoolean = useBooleanish (toRef (props , ' noHeader' ))
63
75
const noFooterBoolean = useBooleanish (toRef (props , ' noFooter' ))
76
+ const noImgBoolean = useBooleanish (toRef (props , ' noImg' ))
77
+ const imgBottomBoolean = useBooleanish (toRef (props , ' imgBottom' ))
64
78
65
79
const headerAttrs = computed (() => ({
66
80
width: props .headerWidth ,
@@ -83,4 +97,13 @@ const footerAttrs = computed(() => ({
83
97
size: props .footerSize ,
84
98
variant: props .footerVariant ,
85
99
}))
100
+
101
+ const imgAttrs = computed (() => ({
102
+ blank: ! props .imgSrc ? true : false ,
103
+ blankColor: props .imgBlankColor ,
104
+ height: ! props .imgSrc ? props .imgHeight : undefined ,
105
+ src: props .imgSrc ,
106
+ top: ! imgBottomBoolean .value ,
107
+ bottom: imgBottomBoolean .value ,
108
+ }))
86
109
</script >
0 commit comments