1
1
import clsx from 'clsx' ;
2
2
import { Card , CardVariant } from 'components/Card/Card' ;
3
+ import { Icon } from 'components/Icon/Icon' ;
4
+ import { IconButton } from 'components/IconButton/IconButton' ;
3
5
import { ArrowDropdownDownIcon } from 'components/Icons/ArrowDropdownDownIcon' ;
4
6
import { useRef , useState } from 'react' ;
5
7
import { CSSTransition } from 'react-transition-group' ;
@@ -8,6 +10,7 @@ export interface AccordionProps {
8
10
flat ?: boolean ;
9
11
title : React . ReactNode ;
10
12
className ?: string ;
13
+ wrapperClassName ?: string ;
11
14
children ?: React . ReactNode ;
12
15
variant ?: CardVariant ;
13
16
}
@@ -17,15 +20,16 @@ export const Accordion: React.FC<AccordionProps> = ({
17
20
title,
18
21
children,
19
22
className,
20
- variant
23
+ variant,
24
+ wrapperClassName = ''
21
25
} ) => {
22
26
const [ isActive , setIsActive ] = useState ( false ) ;
23
27
24
28
const toggleIsActive = ( ) => setIsActive ( ( previous ) => ! previous ) ;
25
29
26
30
const nodeRef = useRef ( null ) ;
27
31
return (
28
- < Card className = { className } variant = { variant } >
32
+ < Card className = { className } variant = { variant } wrapperClassName = { wrapperClassName } >
29
33
< div
30
34
className = { clsx ( 'ui-flex ui-justify-between ui-items-center ui-select-none' , {
31
35
'ui-cursor-default' : flat
@@ -37,14 +41,14 @@ export const Accordion: React.FC<AccordionProps> = ({
37
41
>
38
42
< h3 className = 'ui-tg-body' > { title } </ h3 >
39
43
{ ! flat && (
40
- < ArrowDropdownDownIcon
41
- className = { clsx (
42
- 'ui-transition-transform ui-text-black-600 dark:ui-text-white ui-text-base' ,
43
- {
44
+ < IconButton rounded size = 'sm' >
45
+ < Icon
46
+ className = { clsx ( 'ui-transition-transform ui-text-primary ui-text-base' , {
44
47
'ui-transform ui-rotate-180 ' : isActive
45
- }
46
- ) }
47
- />
48
+ } ) }
49
+ name = 'Bottom-3'
50
+ />
51
+ </ IconButton >
48
52
) }
49
53
</ div >
50
54
{ /* TODO: update the transition package */ }
0 commit comments