@meve/ui
Version:
Argon design system components library
65 lines (52 loc) • 1.62 kB
JavaScript
import _mergeJSXProps from "@vue/babel-helper-vue-jsx-merge-props";
import { createNamespace, inherit } from '../utils/create';
var _createNamespace = createNamespace('card'),
createComponent = _createNamespace.createComponent,
namespace = _createNamespace.namespace;
function Card(h, props, slots, ctx) {
var renderTitle = function renderTitle() {
if (slots.title) {
return slots.title();
}
if (props.title) {
return h("div", {
"class": namespace('__title')
}, [props.title]);
}
};
var renderSubtitle = function renderSubtitle() {
if (slots.subtitle) {
return slots.subtitle();
}
if (props.subtitle) {
return h("small", {
"class": namespace('__subtitle')
}, [props.subtitle]);
}
};
var renderTitleWrapper = function renderTitleWrapper() {
var title = renderTitle();
var subtitle = renderSubtitle();
if (title || subtitle) {
return h("div", {
"class": namespace('__title-wrapper')
}, [renderTitle(), renderSubtitle()]);
}
};
var renderDescription = function renderDescription() {
if (slots.default) {
return slots.default();
}
if (props.description) {
return h("div", {
"class": namespace('__description')
}, [props.description]);
}
};
return h("div", _mergeJSXProps([{
"class": namespace()
}, inherit(ctx)]), [renderTitleWrapper(), renderDescription(), slots.extra == null ? void 0 : slots.extra()]);
}
var CardPlugin = createComponent(Card);
export var _CardComponent = CardPlugin;
export default CardPlugin;