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

Commit

Permalink
fix: update Accordion props and styles
Browse files Browse the repository at this point in the history
  • Loading branch information
Rickk137 committed Jul 6, 2022
1 parent 4cea3d1 commit f297fc1
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/components/Accordion/Accordion.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import clsx from 'clsx';
import { Card, CardVariant } from 'components/Card/Card';
import { Icon } from 'components/Icon/Icon';
import { IconButton } from 'components/IconButton/IconButton';
import { ArrowDropdownDownIcon } from 'components/Icons/ArrowDropdownDownIcon';
import { useRef, useState } from 'react';
import { CSSTransition } from 'react-transition-group';
Expand All @@ -8,6 +10,7 @@ export interface AccordionProps {
flat?: boolean;
title: React.ReactNode;
className?: string;
wrapperClassName?: string;
children?: React.ReactNode;
variant?: CardVariant;
}
Expand All @@ -17,15 +20,16 @@ export const Accordion: React.FC<AccordionProps> = ({
title,
children,
className,
variant
variant,
wrapperClassName = ''
}) => {
const [isActive, setIsActive] = useState(false);

const toggleIsActive = () => setIsActive((previous) => !previous);

const nodeRef = useRef(null);
return (
<Card className={className} variant={variant}>
<Card className={className} variant={variant} wrapperClassName={wrapperClassName}>
<div
className={clsx('ui-flex ui-justify-between ui-items-center ui-select-none', {
'ui-cursor-default': flat
Expand All @@ -37,14 +41,14 @@ export const Accordion: React.FC<AccordionProps> = ({
>
<h3 className='ui-tg-body'>{title}</h3>
{!flat && (
<ArrowDropdownDownIcon
className={clsx(
'ui-transition-transform ui-text-black-600 dark:ui-text-white ui-text-base',
{
<IconButton rounded size='sm'>
<Icon
className={clsx('ui-transition-transform ui-text-primary ui-text-base', {
'ui-transform ui-rotate-180 ': isActive
}
)}
/>
})}
name='Bottom-3'
/>
</IconButton>
)}
</div>
{/* TODO: update the transition package */}
Expand Down

0 comments on commit f297fc1

Please sign in to comment.