Skip to content
This repository was archived by the owner on Aug 31, 2022. It is now read-only.

Commit 2f6e1bf

Browse files
committed
fix: improve Accordion behaviour
1 parent f297fc1 commit 2f6e1bf

File tree

3 files changed

+22
-12
lines changed

3 files changed

+22
-12
lines changed

src/components/Accordion/Accordion.stories.tsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,17 @@ export const Primary = Template.bind({});
1414

1515
Primary.args = {
1616
title: 'toggle me',
17-
children:
18-
"Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.",
17+
children: (
18+
<>
19+
<br />
20+
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has
21+
been the industrys standard dummy text ever since the 1500s, when an unknown printer took a
22+
galley of type and scrambled it to make a type specimen book. It has survived not only five
23+
centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It
24+
was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum
25+
passages, and more recently with desktop publishing software like Aldus PageMaker including
26+
versions of Lorem Ipsum.
27+
</>
28+
),
1929
variant: 'dark-blue'
2030
};

src/components/Accordion/Accordion.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export const Accordion: React.FC<AccordionProps> = ({
1919
flat = false,
2020
title,
2121
children,
22-
className,
22+
className = 'ui-p-4 sm:ui-p-4',
2323
variant,
2424
wrapperClassName = ''
2525
}) => {
@@ -31,9 +31,12 @@ export const Accordion: React.FC<AccordionProps> = ({
3131
return (
3232
<Card className={className} variant={variant} wrapperClassName={wrapperClassName}>
3333
<div
34-
className={clsx('ui-flex ui-justify-between ui-items-center ui-select-none', {
35-
'ui-cursor-default': flat
36-
})}
34+
className={clsx(
35+
'ui-flex ui-outline-none ui-justify-between ui-items-center ui-select-none',
36+
{
37+
'ui-cursor-default': flat
38+
}
39+
)}
3740
role='button'
3841
tabIndex={0}
3942
onClick={toggleIsActive}
@@ -61,10 +64,7 @@ export const Accordion: React.FC<AccordionProps> = ({
6164
nodeRef={nodeRef}
6265
timeout={300}
6366
>
64-
<div ref={nodeRef}>
65-
<br />
66-
{children}
67-
</div>
67+
<div ref={nodeRef}>{children}</div>
6868
</CSSTransition>
6969
</Card>
7070
);

src/styles/_transitions.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
.ui-accordion-enter.ui-accordion-enter-active {
4141
opacity: 1;
4242
max-height: 1000px;
43-
transition: max-height 0.6s ease-in-out, opacity 220ms ease-in;
43+
transition: max-height 0.5s ease-in-out, opacity 220ms ease-in;
4444
}
4545
.ui-accordion-exit {
4646
opacity: 1;
@@ -50,5 +50,5 @@
5050
opacity: 0.01;
5151
overflow: hidden;
5252
max-height: 0;
53-
transition: max-height 0.4s cubic-bezier(0, 1, 0, 1), opacity 120ms ease-in;
53+
transition: max-height 0.3s cubic-bezier(0, 1, 0, 1), opacity 120ms ease-in;
5454
}

0 commit comments

Comments
 (0)