Update src/app/blog/page.tsx
This commit is contained in:
@@ -54,7 +54,8 @@ export default function BlogPage() {
|
||||
const url = `${apiUrl}/posts/${projectId}?status=published`;
|
||||
const response = await fetch(url, {
|
||||
method: "GET", headers: {
|
||||
"Content-Type": "application/json"},
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
});
|
||||
|
||||
if (response.ok) {
|
||||
@@ -63,7 +64,7 @@ export default function BlogPage() {
|
||||
if (Array.isArray(data) && data.length > 0) {
|
||||
const mappedPosts = data.map((post: any) => ({
|
||||
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`),
|
||||
}));
|
||||
setPosts(mappedPosts);
|
||||
@@ -96,70 +97,74 @@ export default function BlogPage() {
|
||||
>
|
||||
<ReactLenis root>
|
||||
<div className="min-h-screen bg-background">
|
||||
<NavbarStyleFullscreen
|
||||
brandName="MADRID AGENCY"
|
||||
navItems={[
|
||||
{name: "Home", id: "/home"},
|
||||
{name: "Inicio", id: "hero"},
|
||||
{name: "Servicios", id: "services"},
|
||||
{name: "Casos", id: "portfolio"},
|
||||
{name: "Equipo", id: "team"},
|
||||
{name: "Contacto", id: "contact"}
|
||||
]}
|
||||
bottomLeftText="Madrid, España"
|
||||
bottomRightText="hello@madridagency.es"
|
||||
/>
|
||||
<div id="nav" data-section="nav">
|
||||
<NavbarStyleFullscreen
|
||||
brandName="MADRID AGENCY"
|
||||
navItems={[
|
||||
{ name: "Inicio", id: "/" },
|
||||
{ name: "Servicios", id: "/servicios" },
|
||||
{ name: "Equipo", id: "/equipo" },
|
||||
{ name: "Contacto", id: "/contacto" }
|
||||
]}
|
||||
bottomLeftText="Madrid, España"
|
||||
bottomRightText="hello@madridagency.es"
|
||||
/>
|
||||
</div>
|
||||
|
||||
{isLoading ? (
|
||||
<div className="w-content-width mx-auto py-20 text-center">
|
||||
<p className="text-foreground">Loading posts...</p>
|
||||
</div>
|
||||
) : (
|
||||
<BlogCardThree
|
||||
blogs={posts}
|
||||
title="Artículos Destacados"
|
||||
description="Explora nuestras últimas perspectivas y conocimientos del sector"
|
||||
textboxLayout="default"
|
||||
useInvertedBackground="noInvert"
|
||||
animationType="slide-up"
|
||||
carouselMode="buttons"
|
||||
uniformGridCustomHeightClasses="min-h-[600px]"
|
||||
/>
|
||||
<div id="blog-content" data-section="blog-content">
|
||||
<BlogCardThree
|
||||
blogs={posts}
|
||||
title="Artículos Destacados"
|
||||
description="Explora nuestras últimas perspectivas y conocimientos del sector"
|
||||
textboxLayout="default"
|
||||
useInvertedBackground="noInvert"
|
||||
animationType="slide-up"
|
||||
carouselMode="buttons"
|
||||
uniformGridCustomHeightClasses="min-h-[600px]"
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<FooterLogoEmphasis
|
||||
logoText="MADRID AGENCY"
|
||||
columns={[
|
||||
{
|
||||
items: [
|
||||
{label: "Inicio", href: "hero"},
|
||||
{label: "Servicios", href: "services"},
|
||||
{label: "Casos", href: "portfolio"}
|
||||
]
|
||||
},
|
||||
{
|
||||
items: [
|
||||
{label: "Equipo", href: "team"},
|
||||
{label: "Blog", href: "blog"},
|
||||
{label: "Contacto", href: "contact"}
|
||||
]
|
||||
},
|
||||
{
|
||||
items: [
|
||||
{label: "hello@madridagency.es", href: "mailto:hello@madridagency.es"},
|
||||
{label: "+34 91 XXXX XXXX", href: "tel:+34911234567"},
|
||||
{label: "Madrid, España", href: "#"}
|
||||
]
|
||||
},
|
||||
{
|
||||
items: [
|
||||
{label: "Instagram", href: "https://instagram.com"},
|
||||
{label: "LinkedIn", href: "https://linkedin.com"},
|
||||
{label: "Twitter", href: "https://twitter.com"}
|
||||
]
|
||||
}
|
||||
]}
|
||||
/>
|
||||
<div id="footer" data-section="footer">
|
||||
<FooterLogoEmphasis
|
||||
logoText="MADRID AGENCY"
|
||||
columns={[
|
||||
{
|
||||
items: [
|
||||
{ label: "Inicio", href: "/" },
|
||||
{ label: "Servicios", href: "/servicios" },
|
||||
{ label: "Equipo", href: "/equipo" }
|
||||
]
|
||||
},
|
||||
{
|
||||
items: [
|
||||
{ label: "Contacto", href: "/contacto" },
|
||||
{ label: "Blog", href: "/blog" },
|
||||
{ label: "Casos", href: "/servicios" }
|
||||
]
|
||||
},
|
||||
{
|
||||
items: [
|
||||
{ label: "hello@madridagency.es", href: "mailto:hello@madridagency.es" },
|
||||
{ label: "+34 91 XXXX XXXX", href: "tel:+34911234567" },
|
||||
{ label: "Madrid, España", href: "#" }
|
||||
]
|
||||
},
|
||||
{
|
||||
items: [
|
||||
{ label: "Instagram", href: "https://instagram.com" },
|
||||
{ label: "LinkedIn", href: "https://linkedin.com" },
|
||||
{ label: "Twitter", href: "https://twitter.com" }
|
||||
]
|
||||
}
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</ReactLenis>
|
||||
</ThemeProvider>
|
||||
|
||||
Reference in New Issue
Block a user