'use client'; import React from 'react'; import Image from 'next/image'; export interface ContentSectionProps { eyebrow?: React.ReactNode; heading?: React.ReactNode; /** * Plain text when it comes from a `page.json`; while the field is being * edited inline the editor hands over a ReactNode instead, so this must not * assume a string. */ body?: React.ReactNode; imageUrl?: string; imageAlt?: string; } /** * Generic prose section for the non-commerce routes (about, landing copy). * Typography matches the storefront's other sections — the editor supplies the * words and the image, never the layout. */ const ContentSection: React.FC = ({ eyebrow, heading, body, imageUrl, imageAlt, }) => { return (
{eyebrow && (

{eyebrow}

)} {heading && (

{heading}

)} {imageUrl && (
)} {body && (
{typeof body === 'string' ? // Authored as plain paragraphs; blank lines separate them. body .split(/\n{2,}/) .filter((paragraph) => paragraph.trim()) .map((paragraph, index) =>

{paragraph}

) : // Mid-edit: render the editor's node as-is so inline editing // keeps working. Paragraph splitting resumes once saved. body}
)}
); }; export default ContentSection;