feat(BOOK-53): Added component for SEO filters and support filter switching
Approved-by: Chuma Mcphoy (We Ahead)
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
import { Children, cloneElement, isValidElement } from 'react'
|
||||
|
||||
import { accordionVariants } from './variants'
|
||||
|
||||
import type { VariantProps } from 'class-variance-authority'
|
||||
|
||||
import type { AccordionItemProps } from './AccordionItem'
|
||||
import { accordionVariants } from './variants'
|
||||
|
||||
interface AccordionProps
|
||||
extends React.HtmlHTMLAttributes<HTMLUListElement>,
|
||||
@@ -13,14 +12,13 @@ interface AccordionProps
|
||||
export default function Accordion({
|
||||
children,
|
||||
className,
|
||||
theme,
|
||||
variant,
|
||||
type,
|
||||
}: AccordionProps) {
|
||||
return (
|
||||
<ul className={accordionVariants({ className, variant, theme })}>
|
||||
<ul className={accordionVariants({ className, type })}>
|
||||
{Children.map(children, (child) => {
|
||||
if (isValidElement<AccordionItemProps>(child)) {
|
||||
return cloneElement(child, { variant, theme })
|
||||
return cloneElement(child, { type })
|
||||
} else {
|
||||
return child
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user