tethys.backend/resources/js/Components/BaseLevel.vue

35 lines
999 B
Vue
Raw Normal View History

2023-03-03 15:54:28 +00:00
<script>
import { h, defineComponent } from 'vue';
2023-03-03 15:54:28 +00:00
export default defineComponent({
name: 'BaseLevel',
props: {
mobile: Boolean,
type: {
type: String,
default: 'justify-between',
},
},
render() {
const parentClass = [this.type, 'items-center'];
2023-03-03 15:54:28 +00:00
const parentMobileClass = ['flex'];
2023-03-03 15:54:28 +00:00
const parentBaseClass = ['block', 'md:flex'];
2023-03-03 15:54:28 +00:00
const childBaseClass = ['flex', 'shrink-0', 'grow-0', 'items-center', 'justify-center'];
2023-03-03 15:54:28 +00:00
return h(
'div',
{ class: parentClass.concat(this.mobile ? parentMobileClass : parentBaseClass) },
this.$slots.default().map((element, index) => {
const childClass =
!this.mobile && this.$slots.default().length > index + 1 ? childBaseClass.concat(['mb-6', 'md:mb-0']) : childBaseClass;
2023-03-03 15:54:28 +00:00
return h('div', { class: childClass }, [element]);
}),
);
},
});
2023-03-03 15:54:28 +00:00
</script>