import React from 'react'; import { assetUrl } from '../../utils/url'; import { useTranslation } from 'react-i18next'; export type NewsListItem = { id: number | string; title: string; excerpt?: string; image?: string; slug?: string; }; const NewsList: React.FC<{ items: NewsListItem[]; emptyText?: string; seeAllHref?: string; seeAllLabel?: string; }> = ({ items, emptyText, seeAllHref, seeAllLabel }) => { const { t } = useTranslation(); // Use provided text or fallback to translations const emptyTextFinal = emptyText || t('news.no_news'); const seeAllLabelFinal = seeAllLabel || t('news.view_all_news'); return ( <>
{items && items.length > 0 ? ( items.slice(0, 4).map((n) => (

{n.title}

{n.excerpt && (
{n.excerpt}
)}
)) ) : (

{emptyTextFinal}

)}
{seeAllHref && items && items.length > 0 && (
{seeAllLabelFinal}
)} ); }; export default NewsList;