2023-03-03 15:54:28 +00:00
|
|
|
<script>
|
2023-03-24 10:41:52 +00:00
|
|
|
import { h, defineComponent } from 'vue';
|
2023-03-03 15:54:28 +00:00
|
|
|
|
|
|
|
export default defineComponent({
|
2023-03-24 10:41:52 +00:00
|
|
|
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
|
|
|
|
2023-03-24 10:41:52 +00:00
|
|
|
const parentMobileClass = ['flex'];
|
2023-03-03 15:54:28 +00:00
|
|
|
|
2023-03-24 10:41:52 +00:00
|
|
|
const parentBaseClass = ['block', 'md:flex'];
|
2023-03-03 15:54:28 +00:00
|
|
|
|
2023-03-24 10:41:52 +00:00
|
|
|
const childBaseClass = ['flex', 'shrink-0', 'grow-0', 'items-center', 'justify-center'];
|
2023-03-03 15:54:28 +00:00
|
|
|
|
2023-03-24 10:41:52 +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
|
|
|
|
2023-03-24 10:41:52 +00:00
|
|
|
return h('div', { class: childClass }, [element]);
|
|
|
|
}),
|
|
|
|
);
|
|
|
|
},
|
|
|
|
});
|
2023-03-03 15:54:28 +00:00
|
|
|
</script>
|