Skip to content

Commit 17e0c2d

Browse files
fix animations
2 parents 22119c2 + f324cfc commit 17e0c2d

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

apps/website/src/routes/docs/styled/accordion/examples/hero.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@ import { Accordion } from '~/components/ui';
44
export default component$(() => {
55
return (
66
<Accordion.Root class="w-full">
7-
<Accordion.Item id="item-1">
7+
<Accordion.Item>
88
<Accordion.Trigger>Is it accessible?</Accordion.Trigger>
99
<Accordion.Content>
1010
Yes. It adheres to the WAI-ARIA design pattern.
1111
</Accordion.Content>
1212
</Accordion.Item>
13-
<Accordion.Item id="item-2">
13+
<Accordion.Item>
1414
<Accordion.Trigger>Is it styled?</Accordion.Trigger>
1515
<Accordion.Content>
1616
Yes. It comes with default styles that matches the other components&apos;
1717
aesthetic.
1818
</Accordion.Content>
1919
</Accordion.Item>
20-
<Accordion.Item id="item-3">
20+
<Accordion.Item>
2121
<Accordion.Trigger>Is it animated?</Accordion.Trigger>
2222
<Accordion.Content>
2323
Yes. It's animated by default, but you can disable it if you prefer.

apps/website/tailwind.config.cjs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,18 @@ module.exports = {
9898
},
9999
// EXTEND-END
100100
animation: {
101-
'accordion-down': '0.2s ease-out 0s 1 normal forwards accordion-open',
102-
'accordion-up': '0.2s ease-out 0s 1 normal forwards accordion-close',
101+
'accordion-up': 'collapsible-up 0.2s ease-out 0s 1 normal forwards',
102+
'accordion-down': 'collapsible-down 0.2s ease-out 0s 1 normal forwards',
103+
},
104+
keyframes: {
105+
'collapsible-down': {
106+
from: { height: '0' },
107+
to: { height: 'var(--qwikui-collapsible-content-height)' },
108+
},
109+
'collapsible-up': {
110+
from: { height: 'var(--qwikui-collapsible-content-height)' },
111+
to: { height: '0' },
112+
},
103113
},
104114
transitionTimingFunction: {
105115
step: 'cubic-bezier(0.6, 0.6, 0, 1)',

packages/kit-styled/src/components/accordion/accordion.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const Trigger = component$<
2929
<HeadlessAccordion.Trigger
3030
{...props}
3131
class={cn(
32-
'flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180',
32+
'flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all hover:underline [&[data-open]>svg]:rotate-180',
3333
props.class,
3434
)}
3535
>
@@ -45,7 +45,7 @@ const Content = component$<PropsOf<typeof HeadlessAccordion.Content>>((props) =>
4545
<HeadlessAccordion.Content
4646
{...props}
4747
class={cn(
48-
'overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down',
48+
'overflow-hidden text-sm data-[closed]:animate-accordion-up data-[open]:animate-accordion-down',
4949
props.class,
5050
)}
5151
>

0 commit comments

Comments
 (0)