import Essentials from "@/components/Blocks/Essentials"

import type { BlocksProps } from "@/types/components/blocks"
import { BlocksEnums } from "@/types/enums/blocks"

export default function Blocks({ blocks }: BlocksProps) {
  return blocks.map(async (block) => {
    switch (block.typename) {
      case BlocksEnums.block.Essentials:
        return (
          <Essentials key={block.essentials.title} content={block.essentials} />
        )
      default:
        return null
    }
  })
}
