2023-12-09 15:47:03 +01:00
|
|
|
<template>
|
|
|
|
|
<div>
|
2024-05-06 14:12:05 +02:00
|
|
|
<div class="w-full relative flex items-center">
|
2024-04-15 19:39:03 +02:00
|
|
|
<div
|
|
|
|
|
class="cursor-pointer"
|
|
|
|
|
@click="trigger"
|
|
|
|
|
>
|
2023-12-09 15:47:03 +01:00
|
|
|
<slot name="title" />
|
|
|
|
|
</div>
|
2024-04-15 19:39:03 +02:00
|
|
|
<div
|
2024-05-06 14:12:05 +02:00
|
|
|
class="text-gray-400 hover:text-gray-600 absolute -right-2 cursor-pointer p-2"
|
2024-04-15 19:39:03 +02:00
|
|
|
@click="trigger"
|
|
|
|
|
>
|
|
|
|
|
<svg
|
|
|
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
|
|
|
class="h-5 w-5 transition transform duration-500"
|
|
|
|
|
:class="{ 'rotate-180': showContent }"
|
|
|
|
|
viewBox="0 0 20 20"
|
|
|
|
|
fill="currentColor"
|
2023-12-09 15:47:03 +01:00
|
|
|
>
|
2024-04-15 19:39:03 +02:00
|
|
|
<path
|
|
|
|
|
fill-rule="evenodd"
|
|
|
|
|
d="M10 18a8 8 0 100-16 8 8 0 000 16zm1-11a1 1 0 10-2 0v3.586L7.707 9.293a1 1 0 00-1.414 1.414l3 3a1 1 0 001.414 0l3-3a1 1 0 00-1.414-1.414L11 10.586V7z"
|
|
|
|
|
clip-rule="evenodd"
|
2023-12-09 15:47:03 +01:00
|
|
|
/>
|
|
|
|
|
</svg>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<VTransition>
|
2024-04-15 19:39:03 +02:00
|
|
|
<div
|
|
|
|
|
v-if="showContent"
|
|
|
|
|
class="w-full"
|
|
|
|
|
>
|
2023-12-09 15:47:03 +01:00
|
|
|
<slot />
|
|
|
|
|
</div>
|
|
|
|
|
</VTransition>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup>
|
2024-04-15 19:39:03 +02:00
|
|
|
import VTransition from "./transitions/VTransition.vue"
|
|
|
|
|
import { ref, defineProps, defineEmits } from "vue"
|
2023-12-09 15:47:03 +01:00
|
|
|
|
|
|
|
|
const props = defineProps({
|
2024-04-15 19:39:03 +02:00
|
|
|
modelValue: { type: Boolean, default: null },
|
2023-12-09 15:47:03 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const showContent = ref(props.modelValue)
|
2024-04-15 19:39:03 +02:00
|
|
|
const emit = defineEmits(['update:modelValue'])
|
2023-12-09 15:47:03 +01:00
|
|
|
|
|
|
|
|
const trigger = () => {
|
|
|
|
|
showContent.value = !showContent.value
|
2024-04-15 19:39:03 +02:00
|
|
|
emit("update:modelValue", showContent.value)
|
2023-12-09 15:47:03 +01:00
|
|
|
}
|
|
|
|
|
</script>
|