Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<template>
<div
:aria-hidden="isCollapsed ? 'true' : 'false'"
:style="{ height }"
class="tw-p-4 -tw-m-4 tw-overflow-y-hidden tw-relative"
:class="{ collapsed: isCollapsed }"
>
<slot />
</div>
</template>
<script lang="ts" setup>
import { computed } from 'vue'
defineOptions({
compatConfig: {
MODE: 3,
},
})
const props = defineProps<{
isCollapsed: boolean
peek?: string
}>()
defineEmits<{
'update:isCollapsed': [boolean]
}>()
const height = computed(() => {
return !props.isCollapsed ? 'auto' : props.peek ?? '0'
})
</script>
<style lang="postcss" scoped>
.collapsed::after {
content: '';
position: absolute;
inset-inline: 0;
bottom: 0;
top: 60%;
background-image: linear-gradient(rgba(255, 255, 255, 0), rgba(255, 255, 255, 1) 100%);
}
</style>