File tree Expand file tree Collapse file tree 3 files changed +20
-6
lines changed
Expand file tree Collapse file tree 3 files changed +20
-6
lines changed Original file line number Diff line number Diff line change @@ -23,12 +23,12 @@ const AccordionItem: React.FC<AccordionItemProps> = ({
2323} ) => {
2424 const [ ref , { height } ] = useElementSize ( ) ;
2525 return (
26- < div className = "mt-2 mb -2" >
26+ < div className = "my -2" >
2727 < Button
2828 className = { clsx (
2929 "bg-klerosUIComponentsWhiteBackground border-klerosUIComponentsStroke border" ,
3030 "hover-medium-blue hover-short-transition hover:cursor-pointer" ,
31- "rounded-[3px] pt-[11.5px] pr-8 pb -[11.5px] pl-8 " ,
31+ "rounded-[3px] px-8 py -[11.5px]" ,
3232 "flex w-full items-center justify-between" ,
3333 ) }
3434 onPress = { ( ) => setExpanded ( expanded ? - 1 : index ) }
Original file line number Diff line number Diff line change 11import React , { ReactNode , useState } from "react" ;
22import AccordionItem from "./accordion-item" ;
3+ import clsx from "clsx" ;
34
45interface AccordionItem {
56 title : ReactNode ;
@@ -8,12 +9,20 @@ interface AccordionItem {
89
910interface AccordionProps {
1011 items : AccordionItem [ ] ;
12+ className ?: string ;
1113}
1214
13- const CustomAccordion : React . FC < AccordionProps > = ( { items, ...props } ) => {
15+ const CustomAccordion : React . FC < AccordionProps > = ( {
16+ items,
17+ className,
18+ ...props
19+ } ) => {
1420 const [ expanded , setExpanded ] = useState ( - 1 ) ;
1521 return (
16- < div className = "box-border flex w-[1000px] flex-col" { ...props } >
22+ < div
23+ className = { clsx ( "box-border flex w-[1000px] flex-col" , className ) }
24+ { ...props }
25+ >
1726 { items . map ( ( item , index ) => (
1827 < AccordionItem
1928 key = { index }
Original file line number Diff line number Diff line change @@ -12,23 +12,28 @@ interface AccordionItem {
1212interface AccordionProps {
1313 items : AccordionItem [ ] ;
1414 defaultExpanded ?: number ;
15+ className ?: string ;
1516}
1617
1718const DefaultTitle : React . FC < { item : AccordionItem } > = ( { item } ) => (
1819 < >
1920 { item . icon ?? ( item . Icon && < item . Icon /> ) }
20- < p className = { clsx ( "w-fit" , " text-center font-semibold") } > { item . title } </ p >
21+ < p className = "w-fit text-center font-semibold" > { item . title } </ p >
2122 </ >
2223) ;
2324
2425const Accordion : React . FC < AccordionProps > = ( {
2526 items,
2627 defaultExpanded,
28+ className,
2729 ...props
2830} ) => {
2931 const [ expanded , setExpanded ] = useState ( defaultExpanded ?? - 1 ) ;
3032 return (
31- < div className = "box-border flex w-[1000px] flex-col" { ...props } >
33+ < div
34+ className = { clsx ( "box-border flex w-[1000px] flex-col" , className ) }
35+ { ...props }
36+ >
3237 { items . map ( ( item , index ) => (
3338 < AccordionItem
3439 key = { index }
You can’t perform that action at this time.
0 commit comments