From 2f6e1bf213aec8e218202fa86d4180ab47be9724 Mon Sep 17 00:00:00 2001 From: Peiman Date: Thu, 7 Jul 2022 00:10:50 +0430 Subject: [PATCH] fix: improve Accordion behaviour --- src/components/Accordion/Accordion.stories.tsx | 14 ++++++++++++-- src/components/Accordion/Accordion.tsx | 16 ++++++++-------- src/styles/_transitions.scss | 4 ++-- 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/src/components/Accordion/Accordion.stories.tsx b/src/components/Accordion/Accordion.stories.tsx index 749d458..837ead2 100644 --- a/src/components/Accordion/Accordion.stories.tsx +++ b/src/components/Accordion/Accordion.stories.tsx @@ -14,7 +14,17 @@ export const Primary = Template.bind({}); Primary.args = { title: 'toggle me', - children: - "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.", + children: ( + <> +
+ Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has + been the industrys 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. + + ), variant: 'dark-blue' }; diff --git a/src/components/Accordion/Accordion.tsx b/src/components/Accordion/Accordion.tsx index d623ec1..5016f59 100644 --- a/src/components/Accordion/Accordion.tsx +++ b/src/components/Accordion/Accordion.tsx @@ -19,7 +19,7 @@ export const Accordion: React.FC = ({ flat = false, title, children, - className, + className = 'ui-p-4 sm:ui-p-4', variant, wrapperClassName = '' }) => { @@ -31,9 +31,12 @@ export const Accordion: React.FC = ({ return (
= ({ nodeRef={nodeRef} timeout={300} > -
-
- {children} -
+
{children}
); diff --git a/src/styles/_transitions.scss b/src/styles/_transitions.scss index 0a88694..b609d06 100644 --- a/src/styles/_transitions.scss +++ b/src/styles/_transitions.scss @@ -40,7 +40,7 @@ .ui-accordion-enter.ui-accordion-enter-active { opacity: 1; max-height: 1000px; - transition: max-height 0.6s ease-in-out, opacity 220ms ease-in; + transition: max-height 0.5s ease-in-out, opacity 220ms ease-in; } .ui-accordion-exit { opacity: 1; @@ -50,5 +50,5 @@ opacity: 0.01; overflow: hidden; max-height: 0; - transition: max-height 0.4s cubic-bezier(0, 1, 0, 1), opacity 120ms ease-in; + transition: max-height 0.3s cubic-bezier(0, 1, 0, 1), opacity 120ms ease-in; }