import { RichTextBlock } from "./RichTextBlock";
import { ImageWithTextBlock } from "./ImageWithTextBlock";
import { ImageSliderBlock } from "./ImageSliderBlock";
import { HorizontalRuleBlock } from "./HorizontalRuleBlock";
import { FeaturedBlock } from "./FeaturedBlock";

export const Blocks = ({ blocks }: any) => {
  return blocks.map((block: any) => {
    switch (block.blockType) {
      case "RichTextBlock":
        return <RichTextBlock block={block} />;
        break;
      case "ImageWithTextBlock":
        return <ImageWithTextBlock block={block} />;
        break;
      case "ImageSliderBlock":
        return <ImageSliderBlock block={block} />;
        break;
      case "HorizontalRuleBlock":
        return <HorizontalRuleBlock block={block} />;
        break;
      case "FeaturedBlock":
        return <FeaturedBlock block={block} />;
        break;
      default:
        return <div>Unsupported block type {block.blockType}</div>;
        console.log("unsupported block", block);
    }
  });
};