import Link from 'next/link'; import { ArrowUpRight, Calendar } from 'lucide-react'; import { decodeHtmlEntities } from '@/lib/utils'; interface NewsCardProps { id: string; slug: string; titulo: string; resumen: string; tipo?: string; fecha: string; imagenUrl?: string | null; showCategory?: boolean; showFooterDate?: boolean; showFooterButton?: boolean; footerText?: string; isAdmin?: boolean; imageAspect?: string; } export const NewsCard = ({ id, slug, titulo: rawTitulo, resumen: rawResumen, tipo, fecha, imagenUrl, showCategory = false, showFooterDate = false, showFooterButton = false, footerText, isAdmin = false, imageAspect = 'aspect-[16/10]' }: NewsCardProps) => { const titulo = decodeHtmlEntities(rawTitulo); const resumen = decodeHtmlEntities(rawResumen); // Formatear fecha const fechaObj = new Date(fecha); const fechaFormateada = fechaObj.toLocaleDateString('es-ES', { day: '2-digit', month: 'short', year: 'numeric' }); return (
{/* Click Frontal */} Ver {titulo} {/* Edit Button for Admins (Elevado en el stacking context) */} {isAdmin && (
Editar
)} {/* Imagen Destacada */}
{imagenUrl ? ( {titulo} ) : (
{/* No placeholder text as per user request */}
)} {/* Badge/Tag - Habilitable por prop */} {showCategory && (
{tipo?.toUpperCase() || 'NOTICIA'}
)} {/* No button here */}
{/* Contenido */}

{titulo}

{resumen}

{/* Footer del card */} {(showFooterDate || footerText) && (
{showFooterDate ? (
{fechaFormateada}
) : ( footerText || "" )}
{showFooterButton && footerText && (
)}
)}
); };