Skip to content

Commit 33eacb4

Browse files
committed
feat: CCard: add accentColor prop
1 parent fe39b0f commit 33eacb4

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

src/components/card/CCard.vue

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ const props = Object.assign(
1111
headerHtml: String,
1212
bodyHtml: String,
1313
footerHtml: String,
14-
bodyWrapper: Boolean
14+
bodyWrapper: Boolean,
15+
accentColor: String
1516
}
1617
)
1718
export default {
@@ -42,10 +43,11 @@ export default {
4243
mergeData(data, {
4344
staticClass: 'card',
4445
class: {
45-
[`text-${props.align}`]: Boolean(props.align),
46-
[`bg-${props.color}`]: Boolean(props.color),
47-
[`border-${props.borderColor}`]: Boolean(props.borderColor),
48-
[`text-${props.textColor}`]: Boolean(props.textColor)
46+
[`card-accent-${props.accentColor}`]: props.accentColor,
47+
[`text-${props.align}`]: props.align,
48+
[`bg-${props.color}`]: props.color,
49+
[`border-${props.borderColor}`]: props.borderColor,
50+
[`text-${props.textColor}`]: props.textColor
4951
}
5052
}),
5153
[ header, main, footer ]

src/components/card/tests/CCard.spec.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ const slotWrapper = mount(Component, {
2222
color: 'success',
2323
textColor: 'white',
2424
borderColor: 'solid',
25+
accentColor: 'primary',
2526
bodyWrapper: true
2627
}
2728
},
@@ -49,7 +50,7 @@ describe(ComponentName, () => {
4950
it('renders correctly with slots', () => {
5051
expect(slotWrapper.element).toMatchSnapshot()
5152
})
52-
it('renders correctly with slots', () => {
53+
it('renders correctly without body', () => {
5354
expect(noBodyCard.element).toMatchSnapshot()
5455
})
5556
});

src/components/card/tests/__snapshots__/CCard.spec.js.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ exports[`CCard renders correctly 1`] = `
2424

2525
exports[`CCard renders correctly with slots 1`] = `
2626
<div
27-
class="card text-left bg-success border-solid text-white"
27+
class="card card-accent-primary text-left bg-success border-solid text-white"
2828
>
2929
<!---->
3030
<div
@@ -36,7 +36,7 @@ exports[`CCard renders correctly with slots 1`] = `
3636
</div>
3737
`;
3838

39-
exports[`CCard renders correctly with slots 2`] = `
39+
exports[`CCard renders correctly without body 1`] = `
4040
<div
4141
class="card"
4242
>

src/components/index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ export declare class CCard extends CardSharedClasses {
6666
bodyHtml: string
6767
footerHtml: string
6868
bodyWrapper: boolean
69+
accentColor: string
6970
}
7071

7172
export declare class CCardBody extends CardSharedClasses {}

0 commit comments

Comments
 (0)