Skip to content

Commit

Permalink
Refactor #3965 - For Card
Browse files Browse the repository at this point in the history
  • Loading branch information
bahadirsofuoglu committed May 22, 2023
1 parent 6ac09a0 commit 2bb67db
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 9 deletions.
21 changes: 21 additions & 0 deletions components/lib/card/BaseCard.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<script>
import BaseComponent from 'primevue/basecomponent';
const classes = {
root: 'p-card p-component',
header: 'p-card-header',
body: 'p-card-body',
title: 'p-card-title',
subtitle: 'p-card-subtitle',
content: 'p-card-content',
footer: 'p-card-footer'
};
export default {
name: 'BaseCard',
extends: BaseComponent,
css: {
classes
}
};
</script>
5 changes: 5 additions & 0 deletions components/lib/card/Card.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ export interface CardProps {
* @type {CardPassThroughOptions}
*/
pt?: CardPassThroughOptions;
/**
* When enabled, it removes component related styles in the core.
* @defaultValue false
*/
unstyled?: boolean;
}

/**
Expand Down
18 changes: 9 additions & 9 deletions components/lib/card/Card.vue
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
<template>
<div class="p-card p-component" v-bind="ptm('root')">
<div v-if="$slots.header" class="p-card-header" v-bind="ptm('header')">
<div :class="cx('root')" v-bind="ptm('root')">
<div v-if="$slots.header" :class="cx('header')" v-bind="ptm('header')">
<slot name="header"></slot>
</div>
<div class="p-card-body" v-bind="ptm('body')">
<div v-if="$slots.title" class="p-card-title" v-bind="ptm('title')">
<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="p-card-subtitle" v-bind="ptm('subtitle')">
<div v-if="$slots.subtitle" :class="cx('subtitle')" v-bind="ptm('subtitle')">
<slot name="subtitle"></slot>
</div>
<div class="p-card-content" v-bind="ptm('content')">
<div :class="cx('content')" v-bind="ptm('content')">
<slot name="content"></slot>
</div>
<div v-if="$slots.footer" class="p-card-footer" v-bind="ptm('footer')">
<div v-if="$slots.footer" :class="cx('footer')" v-bind="ptm('footer')">
<slot name="footer"></slot>
</div>
</div>
</div>
</template>

<script>
import BaseComponent from 'primevue/basecomponent';
import BaseCard from './BaseCard.vue';
export default {
name: 'Card',
extends: BaseComponent
extends: BaseCard
};
</script>

0 comments on commit 2bb67db

Please sign in to comment.