-
Notifications
You must be signed in to change notification settings - Fork 3.1k
/
TopNavList.vue
56 lines (52 loc) · 1.52 KB
/
TopNavList.vue
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
44
45
46
47
48
49
50
51
52
53
54
55
56
<template>
<Popover
class="bg-white relative"
#="{ open, close }"
>
<PopoverButton
class="flex-grow h-full group focus:outline-none focus:ring-0"
@click="emit('clearForceOpen')"
>
<div
class="flex gap-8px items-center group-hocus:text-indigo-600"
:class="(open || props.forceOpenState) ? 'text-indigo-600' : 'text-gray-600'"
>
<slot
name="heading"
:open="open"
:close="close"
/>
<i-cy-chevron-down
class="transform transition-all w-10px duration-300 group-hocus:icon-dark-indigo-500"
:class="(open || props.forceOpenState) ? 'rotate-180 icon-dark-indigo-500' : 'icon-dark-gray-200'"
/>
</div>
</PopoverButton>
<TransitionQuickFade>
<PopoverPanel
static
class="bg-white rounded shadow-dropdown top-36px right-0 z-10 absolute"
:class="(forceOpenState === true) || open ? '' : 'hidden'"
>
<ul
v-if="variant !== 'panel'"
class="flex flex-col max-h-50vh overflow-auto"
>
<slot />
</ul>
<slot v-else />
</PopoverPanel>
</TransitionQuickFade>
</Popover>
</template>
<script setup lang="ts">
import { Popover, PopoverButton, PopoverPanel } from '@headlessui/vue'
import TransitionQuickFade from '@cy/components/transitions/TransitionQuickFade.vue'
const props = defineProps<{
variant?: string
forceOpenState?: boolean
}>()
const emit = defineEmits<{
(e: 'clearForceOpen'): void
}>()
</script>