import { Parish } 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 { DonationForm } from '@/components/DonationForm/DonationForm' import { YoutubePlayer } from '@/components/YoutubePlayer/YoutubePlayer' import { DonationAppeal } from '@/components/DonationAppeal/DonationAppeal' type BlocksProps = { content: Parish['content'] } export function ParishBlocks({ content }: BlocksProps) { if (!content) return null; // 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 === "donation") { return
} if (item.blockType === "youtube") { return
} if (item.blockType === "donationAppeal") { return
} })}
{ shouldAddMargin &&
} ) }