import { graphql } from "@/gql";
import { type AccordionBlockFragment } from "@/gql/graphql";
import { Blocks } from "./Blocks";
import { Accordion } from "@/components/general/Accordion";

const AccordionBlockFragmentDefinition = graphql(`
  fragment AccordionBlock on AccordionBlock {
    heading
    body {
      id
      blockType
    }
  }
`);

export const AccordionBlock = ({
  block,
}: {
  block: AccordionBlockFragment;
}) => {
  return (
    <Accordion heading={block.heading}>
      <Blocks blocks={block.body} />
    </Accordion>
  );
};
