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,25 +97,26 @@ export default function BlogPage() {
> >
<ReactLenis root> <ReactLenis root>
<div className="min-h-screen bg-background"> <div className="min-h-screen bg-background">
<div id="nav" data-section="nav">
<NavbarStyleFullscreen <NavbarStyleFullscreen
brandName="MADRID AGENCY" brandName="MADRID AGENCY"
navItems={[ navItems={[
{name: "Home", id: "/home"}, { name: "Inicio", id: "/" },
{name: "Inicio", id: "hero"}, { name: "Servicios", id: "/servicios" },
{name: "Servicios", id: "services"}, { name: "Equipo", id: "/equipo" },
{name: "Casos", id: "portfolio"}, { name: "Contacto", id: "/contacto" }
{name: "Equipo", id: "team"},
{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>
) : ( ) : (
<div id="blog-content" data-section="blog-content">
<BlogCardThree <BlogCardThree
blogs={posts} blogs={posts}
title="Artículos Destacados" title="Artículos Destacados"
@@ -125,23 +127,25 @@ export default function BlogPage() {
carouselMode="buttons" carouselMode="buttons"
uniformGridCustomHeightClasses="min-h-[600px]" uniformGridCustomHeightClasses="min-h-[600px]"
/> />
</div>
)} )}
<div id="footer" data-section="footer">
<FooterLogoEmphasis <FooterLogoEmphasis
logoText="MADRID AGENCY" logoText="MADRID AGENCY"
columns={[ columns={[
{ {
items: [ items: [
{label: "Inicio", href: "hero"}, { label: "Inicio", href: "/" },
{label: "Servicios", href: "services"}, { label: "Servicios", href: "/servicios" },
{label: "Casos", href: "portfolio"} { label: "Equipo", href: "/equipo" }
] ]
}, },
{ {
items: [ items: [
{label: "Equipo", href: "team"}, { label: "Contacto", href: "/contacto" },
{label: "Blog", href: "blog"}, { label: "Blog", href: "/blog" },
{label: "Contacto", href: "contact"} { label: "Casos", href: "/servicios" }
] ]
}, },
{ {
@@ -161,6 +165,7 @@ export default function BlogPage() {
]} ]}
/> />
</div> </div>
</div>
</ReactLenis> </ReactLenis>
</ThemeProvider> </ThemeProvider>
); );