import { Link } from 'react-router-dom'; import type { HeroSectionPayload } from '@homaroma/types'; import { useTranslation } from 'react-i18next'; import { getLocalizedField } from '../utils/localization'; interface DynamicHeroProps { payload: HeroSectionPayload; } export default function DynamicHero({ payload }: DynamicHeroProps) { const { t, i18n } = useTranslation(); const lang = i18n.language; const { imageUrl, buttonLink } = payload; const tagline = getLocalizedField(payload.tagline, lang); const title = getLocalizedField(payload.title, lang); const description = getLocalizedField(payload.description, lang); const buttonText = getLocalizedField(payload.buttonText, lang); 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 ( { (e.target as HTMLImageElement).style.display = 'none'; }} /> {/* Dark gradient overlay for premium vibe */} {tagline || t('hero.defaultTagline')} {renderTitle(title) || renderTitle(t('hero.defaultTitle'))} {description} {buttonText || t('hero.exploreCollection')} {t('hero.learnMore')} → ); }
{tagline || t('hero.defaultTagline')}
{description}