import type { HeroArticlePayload } from '@homaroma/types'; import { useTranslation } from 'react-i18next'; import { getLocalizedField } from '../utils/localization'; interface DynamicHeroArticleProps { payload: HeroArticlePayload & { imageUrl?: string; date?: string; category?: string | { [key: string]: string }; }; } export default function DynamicHeroArticle({ payload }: DynamicHeroArticleProps) { const { t, i18n } = useTranslation(); const lang = i18n.language; const p = payload || {}; const { imageUrl, date } = p; const title = getLocalizedField(p.title, lang); const subtitle = getLocalizedField(p.subtitle, lang); const author = getLocalizedField(p.author, lang); const category = getLocalizedField(p.category, lang); return (
{imageUrl && (
{title
)}
{category && ( {category} )}

{title || t('newsletter.articleDefaultTitle', 'Scent Guide Article')}

{subtitle && (

{subtitle}

)} {(author || date) && (
{author && {t('newsletter.byAuthor', { author })}} {author && date && •} {date && {date}}
)}
); }