import * as Accordion from './index'

interface AccordionProps extends React.Attributes {
  items: Array<Record<string, any>>
}

export default ({ items, ...props }: AccordionProps) => (
  <Accordion.Root type="single" collapsible tw="w-[450px]" {...props}>
    {items?.map(({ title, content }, i) => (
      <Accordion.Item key={`item-${i}`} value={`item-${i}`}>
        <Accordion.Trigger>{title}</Accordion.Trigger>
        <Accordion.Content>{content}</Accordion.Content>
      </Accordion.Item>
    ))}
  </Accordion.Root>
)
