Skip to content

Commit

Permalink
Fixed #5020 - Add caption option to passthrough options on Card
Browse files Browse the repository at this point in the history
  • Loading branch information
mertsincan committed Jan 3, 2024
1 parent 4c57243 commit 8e1354d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
4 changes: 4 additions & 0 deletions components/lib/card/Card.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ export interface CardPassThroughOptions {
* Used to pass attributes to the body's DOM element.
*/
body?: CardPassThroughOptionType;
/**
* Used to pass attributes to the caption's DOM element.
*/
caption?: CardPassThroughOptionType;
/**
* Used to pass attributes to the title's DOM element.
*/
Expand Down
12 changes: 7 additions & 5 deletions components/lib/card/Card.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
<slot name="header"></slot>
</div>
<div :class="cx('body')" v-bind="ptm('body')">
<div v-if="$slots.title" :class="cx('title')" v-bind="ptm('title')">
<slot name="title"></slot>
</div>
<div v-if="$slots.subtitle" :class="cx('subtitle')" v-bind="ptm('subtitle')">
<slot name="subtitle"></slot>
<div v-if="$slots.title || $slots.subtitle" :class="cx('caption')" v-bind="ptm('caption')">
<div v-if="$slots.title" :class="cx('title')" v-bind="ptm('title')">
<slot name="title"></slot>
</div>
<div v-if="$slots.subtitle" :class="cx('subtitle')" v-bind="ptm('subtitle')">
<slot name="subtitle"></slot>
</div>
</div>
<div :class="cx('content')" v-bind="ptm('content')">
<slot name="content"></slot>
Expand Down
1 change: 1 addition & 0 deletions components/lib/card/style/CardStyle.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const classes = {
root: 'p-card p-component',
header: 'p-card-header',
body: 'p-card-body',
caption: 'p-card-caption',
title: 'p-card-title',
subtitle: 'p-card-subtitle',
content: 'p-card-content',
Expand Down

0 comments on commit 8e1354d

Please sign in to comment.