Update src/app/blog/page.tsx

This commit is contained in:
2026-02-06 17:54:01 +00:00
parent 4bb187f791
commit 76d10e1ab7

View File

@@ -54,7 +54,8 @@ export default function BlogPage() {
const url = `${apiUrl}/posts/${projectId}?status=published`; const url = `${apiUrl}/posts/${projectId}?status=published`;
const response = await fetch(url, { const response = await fetch(url, {
method: "GET", headers: { method: "GET", headers: {
"Content-Type": "application/json"}, "Content-Type": "application/json"
},
}); });
if (response.ok) { if (response.ok) {
@@ -63,7 +64,7 @@ export default function BlogPage() {
if (Array.isArray(data) && data.length > 0) { if (Array.isArray(data) && data.length > 0) {
const mappedPosts = data.map((post: any) => ({ const mappedPosts = data.map((post: any) => ({
id: post.id || String(Math.random()), id: post.id || String(Math.random()),
category: post.category || "General", title: post.title || "Untitled", excerpt: post.excerpt || post.content.slice(0, 30) || "", imageSrc: post.imageUrl || "/placeholders/placeholder3.avif", imageAlt: post.imageAlt || post.title || "", authorName: post.author?.name || "Anonymous", authorAvatar: post.author?.avatar || "/placeholders/placeholder3.avif", date: post.date || post.createdAt || new Date().toLocaleDateString("en-GB", { day: "numeric", month: "short", year: "numeric" }), category: post.category || "General", title: post.title || "Untitled", excerpt: post.excerpt || post.content?.slice(0, 30) || "", imageSrc: post.imageUrl || "/placeholders/placeholder3.avif", imageAlt: post.imageAlt || post.title || "", authorName: post.author?.name || "Anonymous", authorAvatar: post.author?.avatar || "/placeholders/placeholder3.avif", date: post.date || post.createdAt || new Date().toLocaleDateString("en-GB", { day: "numeric", month: "short", year: "numeric" }),
onBlogClick: () => console.log(`Blog ${post.id} clicked`), onBlogClick: () => console.log(`Blog ${post.id} clicked`),
})); }));
setPosts(mappedPosts); setPosts(mappedPosts);
@@ -96,70 +97,74 @@ export default function BlogPage() {
> >
<ReactLenis root> <ReactLenis root>
<div className="min-h-screen bg-background"> <div className="min-h-screen bg-background">
<NavbarStyleFullscreen <div id="nav" data-section="nav">
brandName="MADRID AGENCY" <NavbarStyleFullscreen
navItems={[ brandName="MADRID AGENCY"
{name: "Home", id: "/home"}, navItems={[
{name: "Inicio", id: "hero"}, { name: "Inicio", id: "/" },
{name: "Servicios", id: "services"}, { name: "Servicios", id: "/servicios" },
{name: "Casos", id: "portfolio"}, { name: "Equipo", id: "/equipo" },
{name: "Equipo", id: "team"}, { name: "Contacto", id: "/contacto" }
{name: "Contacto", id: "contact"} ]}
]} bottomLeftText="Madrid, España"
bottomLeftText="Madrid, España" bottomRightText="hello@madridagency.es"
bottomRightText="hello@madridagency.es" />
/> </div>
{isLoading ? ( {isLoading ? (
<div className="w-content-width mx-auto py-20 text-center"> <div className="w-content-width mx-auto py-20 text-center">
<p className="text-foreground">Loading posts...</p> <p className="text-foreground">Loading posts...</p>
</div> </div>
) : ( ) : (
<BlogCardThree <div id="blog-content" data-section="blog-content">
blogs={posts} <BlogCardThree
title="Artículos Destacados" blogs={posts}
description="Explora nuestras últimas perspectivas y conocimientos del sector" title="Artículos Destacados"
textboxLayout="default" description="Explora nuestras últimas perspectivas y conocimientos del sector"
useInvertedBackground="noInvert" textboxLayout="default"
animationType="slide-up" useInvertedBackground="noInvert"
carouselMode="buttons" animationType="slide-up"
uniformGridCustomHeightClasses="min-h-[600px]" carouselMode="buttons"
/> uniformGridCustomHeightClasses="min-h-[600px]"
/>
</div>
)} )}
<FooterLogoEmphasis <div id="footer" data-section="footer">
logoText="MADRID AGENCY" <FooterLogoEmphasis
columns={[ logoText="MADRID AGENCY"
{ columns={[
items: [ {
{label: "Inicio", href: "hero"}, items: [
{label: "Servicios", href: "services"}, { label: "Inicio", href: "/" },
{label: "Casos", href: "portfolio"} { label: "Servicios", href: "/servicios" },
] { label: "Equipo", href: "/equipo" }
}, ]
{ },
items: [ {
{label: "Equipo", href: "team"}, items: [
{label: "Blog", href: "blog"}, { label: "Contacto", href: "/contacto" },
{label: "Contacto", href: "contact"} { label: "Blog", href: "/blog" },
] { label: "Casos", href: "/servicios" }
}, ]
{ },
items: [ {
{label: "hello@madridagency.es", href: "mailto:hello@madridagency.es"}, items: [
{label: "+34 91 XXXX XXXX", href: "tel:+34911234567"}, { label: "hello@madridagency.es", href: "mailto:hello@madridagency.es" },
{label: "Madrid, España", href: "#"} { label: "+34 91 XXXX XXXX", href: "tel:+34911234567" },
] { label: "Madrid, España", href: "#" }
}, ]
{ },
items: [ {
{label: "Instagram", href: "https://instagram.com"}, items: [
{label: "LinkedIn", href: "https://linkedin.com"}, { label: "Instagram", href: "https://instagram.com" },
{label: "Twitter", href: "https://twitter.com"} { label: "LinkedIn", href: "https://linkedin.com" },
] { label: "Twitter", href: "https://twitter.com" }
} ]
]} }
/> ]}
/>
</div>
</div> </div>
</ReactLenis> </ReactLenis>
</ThemeProvider> </ThemeProvider>