mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender.git
synced 2025-07-19 19:18:48 +02:00
115 refactor dynamic page component
This commit is contained in:
63
frontend/src/view/DynamicPage.vue
Normal file
63
frontend/src/view/DynamicPage.vue
Normal file
@ -0,0 +1,63 @@
|
||||
<script lang="ts" setup>
|
||||
import { computed, useSlots } from 'vue';
|
||||
|
||||
defineProps<{
|
||||
hideContent: Boolean,
|
||||
headline: String,
|
||||
subTitle?: String,
|
||||
icon?: String,
|
||||
}>()
|
||||
|
||||
const slots = useSlots()
|
||||
const hasSlot = (name:string) => {
|
||||
return !!slots[name];
|
||||
}
|
||||
const hasContent = computed(() => {
|
||||
return hasSlot('content')
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
class="flex flex-column align-items-center transition-all transition-duration-500 transition-ease-in-out mt-0"
|
||||
:class="{'md:mt-8': hideContent}"
|
||||
>
|
||||
<div class="flex align-items-center justify-content-center gap-2 mx-2">
|
||||
<h3 class="text-4xl">
|
||||
{{ headline }}
|
||||
</h3>
|
||||
<i
|
||||
v-if="icon"
|
||||
:class="icon"
|
||||
style="font-size: 2rem"
|
||||
></i>
|
||||
</div>
|
||||
<div
|
||||
v-if="subTitle"
|
||||
class="flex justify-content-center"
|
||||
>
|
||||
<h5 class="text-2xl m-2">{{ subTitle }}</h5>
|
||||
</div>
|
||||
<div
|
||||
class="flex flex-wrap mx-0 gap-2 my-4 w-full lg:w-8"
|
||||
>
|
||||
<slot
|
||||
name="selection"
|
||||
class="flex-1 m-0"
|
||||
></slot>
|
||||
</div>
|
||||
<div
|
||||
v-if="hasContent"
|
||||
:class="
|
||||
[hideContent?
|
||||
['opacity-0', 'pointer-events-none', 'h-1rem', 'overflow-hidden'] :
|
||||
['opacity-100', 'transition-all', 'transition-duration-500', 'transition-ease-in-out']
|
||||
,
|
||||
'w-full', 'lg:w-8']"
|
||||
>
|
||||
<slot
|
||||
name="content"
|
||||
></slot>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
Reference in New Issue
Block a user