2
0
mirror of https://github.com/frappe/books.git synced 2025-02-05 13:38:31 +00:00
books/src/components/Row.vue

42 lines
765 B
Vue
Raw Normal View History

<template>
2019-10-05 01:48:10 +05:30
<div class="grid border-b" :style="style">
<slot></slot>
</div>
</template>
2019-10-04 23:30:51 +05:30
<script>
export default {
name: 'Row',
2019-10-04 23:30:51 +05:30
props: {
columnWidth: {
type: String,
default: '1fr'
},
2019-10-04 23:30:51 +05:30
columnCount: {
type: Number,
default: 0
},
ratio: {
type: Array,
default: () => []
2019-10-14 03:26:20 +05:30
},
gap: String
2019-10-04 23:30:51 +05:30
},
computed: {
style() {
2019-10-14 03:26:20 +05:30
let obj = {};
if (this.columnCount) {
obj['grid-template-columns'] = `repeat(${this.columnCount}, ${this.columnWidth})`;
}
if (this.ratio.length) {
2019-10-14 03:26:20 +05:30
obj['grid-template-columns'] = this.ratio.map(r => `${r}fr`).join(' ');
}
if (this.gap) {
obj['grid-gap'] = this.gap;
2019-10-04 23:30:51 +05:30
}
2019-10-14 03:26:20 +05:30
return obj;
2019-10-04 23:30:51 +05:30
}
}
2019-10-14 03:26:20 +05:30
};
2019-10-04 23:30:51 +05:30
</script>