import { Link } from 'react-router-dom'; import type { EditorialTileSectionPayload } from '@homaroma/types'; interface DynamicEditorialTileProps { payload: EditorialTileSectionPayload; } export default function DynamicEditorialTile({ payload }: DynamicEditorialTileProps) { const { title, description, imageUrl, imagePosition = 'left', buttonText, buttonLink, backgroundColor = '#FDFDF9', // Default to spa-light textColor = '#1F3D2D' // Default to spa-forest } = payload; const renderTitle = (text: string) => { if (!text) return null; return text.split('[').map((part, i) => { if (part.includes(']')) { const [accent, rest] = part.split(']'); return ( {accent} {rest} ); } return {part}; }); }; return ( {/* Image Column */} { (e.target as HTMLImageElement).style.display = 'none'; }} /> {/* Subtle overlay */} {/* Content Column */} {renderTitle(title) || title} {description} {buttonText && buttonLink && ( {buttonText} )} ); }
{description}