import { Blog } from "@/payload-types" import { Container } from '@/components/Container/Container' import { HTMLText } from '@/components/Text/HTMLText' import { Section } from '@/components/Section/Section' import { Button } from '@/components/Button/Button' import { ContactSection } from '@/compositions/ContactSection/ContactSection' import { Gallery } from '@/components/Gallery/Gallery' import { transformGallery } from '@/utils/dto/gallery' type BlocksProps = { content: Blog['content'] } export function Blocks({ content }: BlocksProps) { // determine if some margin at the bottom should be added const length = content.length; const shouldAddMargin = content[length - 1].blockType === "text" return ( <>
{content.map(item => { if (item.blockType === "text" && item.content_html) { return ( ); } if (item.blockType === "document" && typeof item.file === "object") { return (
) } if (item.blockType === "contactform") { return ( ) } if (item.blockType === "gallery") { return (
) } })}
{ shouldAddMargin &&
} ) }