import {ButtonConfig, ImageConfig} from "@/types/types";
import {BlocksContent} from "@strapi/blocks-react-renderer";
import BlockWithRightImage from "@/components/block.with.right.image.component";
import BlockWithLeftImage from "@/components/block.with.left.image.component";


export interface BlockWithImageComponentProps {
    id?: string;
    title?: string;
    header?: string;
    block: BlocksContent;
    image: ImageConfig;
    button?: ButtonConfig;
}

export default function BlockWithImageComponent({
                                                    block,
                                                    image,
                                                    id,
                                                    title,
                                                    header,
                                                    button
                                                }: BlockWithImageComponentProps) {
    return (
        <>
            {image?.position == 'Right' && <BlockWithRightImage
                block={block} image={image} id={id} title={title}
                header={header}
                button={button}/>}
            {image?.position == 'Left' && <BlockWithLeftImage block={block} image={image} id={id} title={title}
                                                              header={header}
                                                              button={button}/>}
        </>
    );
}
