Skip to content

Commit c5f77b7

Browse files
committed
fix: chevrons on homepage
1 parent b8c8ac5 commit c5f77b7

File tree

1 file changed

+42
-39
lines changed

1 file changed

+42
-39
lines changed

apps/frontend/src/components/elements/Accordion.vue

Lines changed: 42 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,54 @@
11
<template>
22
<div class="flex flex-col gap-[1px]">
3-
<div
4-
v-for="(item, index) in props.items"
5-
:key="index"
6-
class="bg-neutral-950 transition-colors focus-within:bg-neutral-900 hover:bg-neutral-900"
7-
>
8-
<button
9-
class="hover:text-brand-50 focus:text-brand-50 flex w-full cursor-pointer items-center justify-between p-4 outline-0 transition-colors"
10-
@click="toggleAccordion(index)"
11-
@mousedown.prevent
12-
>
13-
<h2>
14-
{{ item.title }}
15-
</h2>
16-
<Icon
17-
name="memory:chevron-up"
18-
:size="24"
19-
:class="{ 'rotate-180': activeIndex !== index }"
20-
mode="svg"
21-
class="transition-transform"
22-
/>
23-
</button>
3+
<client-only>
244
<div
25-
class="overflow-hidden transition-[max-height] duration-300 ease-in-out"
26-
:style="{
27-
maxHeight: activeIndex === index ? contentHeights[index] + 'px' : '0',
28-
}"
5+
v-for="(item, index) in props.items"
6+
:key="index"
7+
class="bg-neutral-950 transition-colors focus-within:bg-neutral-900 hover:bg-neutral-900"
298
>
9+
<button
10+
class="hover:text-brand-50 focus:text-brand-50 flex w-full cursor-pointer items-center justify-between p-4 outline-0 transition-colors"
11+
@click="toggleAccordion(index)"
12+
@mousedown.prevent
13+
>
14+
<h2>
15+
{{ item.title }}
16+
</h2>
17+
<Icon
18+
name="memory:chevron-up"
19+
:size="24"
20+
:class="{ 'rotate-180': activeIndex !== index }"
21+
mode="svg"
22+
class="transition-transform"
23+
/>
24+
</button>
3025
<div
31-
:ref="(el) => setContentRef(el as Element | null, index)"
32-
class="text-default-font/75 p-4 pt-0"
26+
class="overflow-hidden transition-[max-height] duration-300 ease-in-out"
27+
:style="{
28+
maxHeight:
29+
activeIndex === index ? contentHeights[index] + 'px' : '0',
30+
}"
3331
>
34-
<template v-if="activeIndex == index || oldIndex == index">
35-
<p v-if="item.text">
36-
{{ item.text }}
37-
</p>
38-
<template v-else>
39-
<component
40-
v-for="(vnode, vnodeIndex) in (item.inner as Function)()"
41-
:key="vnodeIndex"
42-
:is="vnode"
43-
/>
32+
<div
33+
:ref="(el) => setContentRef(el as Element | null, index)"
34+
class="text-default-font/75 p-4 pt-0"
35+
>
36+
<template v-if="activeIndex == index || oldIndex == index">
37+
<p v-if="item.text">
38+
{{ item.text }}
39+
</p>
40+
<template v-else>
41+
<component
42+
v-for="(vnode, vnodeIndex) in (item.inner as Function)()"
43+
:key="vnodeIndex"
44+
:is="vnode"
45+
/>
46+
</template>
4447
</template>
45-
</template>
48+
</div>
4649
</div>
4750
</div>
48-
</div>
51+
</client-only>
4952
</div>
5053
</template>
5154

0 commit comments

Comments
 (0)