Skip to content

Commit cdebeb6

Browse files
committed
fix(Example NextJS): Add optional chaining to blogs and destinations components, and enhance BlogListingPage footer layout
1 parent 57a351d commit cdebeb6

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

examples/nextjs/src/components/footer/components/blogs.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import RecommendedCard from '@/components/RecommendedCard';
22

33
export default function Blogs({ blogs }) {
44

5-
if (!blogs.length) return null;
5+
if (!blogs?.length) return null;
66

77
return (
88
<div className="flex flex-col">

examples/nextjs/src/components/footer/components/destinations.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import RecommendedCard from '@/components/RecommendedCard';
22

33
export default function Destinations({ destinations }) {
4-
if (!destinations.length) return null;
4+
if (!destinations?.length) return null;
55

66
return (
77
<div className="flex flex-col">

examples/nextjs/src/pages/BlogListingPage.js

+11-4
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,13 @@ export function BlogListingPage(pageResponse) {
4545
</div>
4646
)}
4747
</main>
48+
<footer className="bg-slate-50 text-slate-900 py-4">
49+
<div className="container mx-auto px-4">
50+
<p className="text-center">
51+
&copy; {new Date().getFullYear()} TravelLux. All rights reserved.
52+
</p>
53+
</div>
54+
</footer>
4855
</div>
4956
);
5057
}
@@ -103,7 +110,7 @@ const BlogCard = ({ blog }) => {
103110
const isEditMode = useIsEditMode();
104111

105112
return (
106-
<div className="bg-white rounded-lg shadow-md overflow-hidden hover:shadow-lg transition-shadow duration-300 relative">
113+
<div className="bg-white rounded-lg shadow-md overflow-hidden hover:shadow-lg transition-shadow duration-300 relative flex flex-col h-full">
107114
{isEditMode && (
108115
<button
109116
onClick={() => editContentlet(blog)}
@@ -128,9 +135,9 @@ const BlogCard = ({ blog }) => {
128135
)}
129136
</div>
130137

131-
<div className="p-4">
138+
<div className="p-4 flex flex-col flex-grow">
132139
<h3 className="text-lg font-bold mb-2 hover:text-blue-600">
133-
<a href={urlMap || `#${identifier}`}>{title}</a>
140+
<a href={urlMap}>{title}</a>
134141
</h3>
135142

136143
{teaser && (
@@ -139,7 +146,7 @@ const BlogCard = ({ blog }) => {
139146
</p>
140147
)}
141148

142-
<div className="flex justify-between items-center mt-3">
149+
<div className="flex justify-between items-center mt-auto pt-3 border-t border-gray-100">
143150
{author && (
144151
<div className="text-sm text-gray-700">
145152
{author.firstName && author.lastName

0 commit comments

Comments
 (0)