Skip to content

Commit 041156d

Browse files
committed
feat(BPlaceholderCard): add placeholder img
1 parent ac71dee commit 041156d

File tree

1 file changed

+28
-5
lines changed

1 file changed

+28
-5
lines changed

packages/bootstrap-vue-3/src/components/BPlaceholder/BPlaceholderCard.vue

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
<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+
59
<template v-if="!noHeaderBoolean" #header>
610
<slot name="header">
711
<b-placeholder v-bind="headerAttrs" />
@@ -26,6 +30,7 @@
2630

2731
<script setup lang="ts">
2832
import BCard from '../BCard/BCard.vue'
33+
import BCardImg from '../BCard/BCardImg.vue'
2934
import BPlaceholder from './BPlaceholder.vue'
3035
import {Booleanish, ColorVariant} from '../../types'
3136
import {computed, toRef} from 'vue'
@@ -37,17 +42,20 @@ interface Props {
3742
headerVariant?: ColorVariant
3843
headerAnimation?: 'glow' | 'wave'
3944
headerSize?: 'xs' | 'sm' | 'lg'
40-
4145
noFooter?: Booleanish
4246
footerWidth?: string | number
4347
footerVariant?: ColorVariant
4448
footerAnimation?: 'glow' | 'wave'
4549
footerSize?: 'xs' | 'sm' | 'lg'
46-
4750
animation?: 'glow' | 'wave'
4851
size?: 'xs' | 'sm' | 'lg'
4952
variant?: ColorVariant
5053
noButton?: Booleanish
54+
imgBottom?: Booleanish
55+
imgSrc?: string
56+
imgBlankColor?: string
57+
imgHeight?: string | number
58+
noImg?: Booleanish
5159
}
5260
5361
const props = withDefaults(defineProps<Props>(), {
@@ -56,11 +64,17 @@ const props = withDefaults(defineProps<Props>(), {
5664
footerWidth: 100,
5765
noHeader: false,
5866
noFooter: false,
67+
imgBlankColor: '#868e96',
68+
imgHeight: 100,
69+
imgBottom: false,
70+
noImg: false,
5971
})
6072
6173
const noButtonBoolean = useBooleanish(toRef(props, 'noButton'))
6274
const noHeaderBoolean = useBooleanish(toRef(props, 'noHeader'))
6375
const noFooterBoolean = useBooleanish(toRef(props, 'noFooter'))
76+
const noImgBoolean = useBooleanish(toRef(props, 'noImg'))
77+
const imgBottomBoolean = useBooleanish(toRef(props, 'imgBottom'))
6478
6579
const headerAttrs = computed(() => ({
6680
width: props.headerWidth,
@@ -83,4 +97,13 @@ const footerAttrs = computed(() => ({
8397
size: props.footerSize,
8498
variant: props.footerVariant,
8599
}))
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+
}))
86109
</script>

0 commit comments

Comments
 (0)