@gitlab/ui
Version:
GitLab UI Components
38 lines (32 loc) • 773 B
JavaScript
import { extend } from '../../../vue';
// --- Props ---
const props = {
stacked: {
type: [Boolean, String],
required: false,
default: false
}
};
// --- Mixin ---
// @vue/component
const stackedMixin = extend({
props,
computed: {
isStacked() {
const stacked = this.stacked;
// `true` when always stacked, or returns breakpoint specified
return stacked === '' ? true : stacked;
},
isStackedAlways() {
return this.isStacked === true;
},
stackedTableClasses() {
const isStackedAlways = this.isStackedAlways;
return {
'b-table-stacked': isStackedAlways,
[`b-table-stacked-${this.stacked}`]: !isStackedAlways && this.isStacked
};
}
}
});
export { props, stackedMixin };