- {posts.length > 0 ? (
- posts.map((post) =>
)
- ) : (
-
No posts available
- )}
+
+
+
+
+
+
+
+ {blogPosts.map((post) => (
+
onCardClick(post)} // Handle card click
+ >
+

+
+
{post.title}
+
{post.author}
+
{post.date}
+
+
+ ))}
+
-
-
+
);
};
diff --git a/src/pages/Home.jsx b/src/pages/Home.jsx
index c43fc63..9ecfb1a 100644
--- a/src/pages/Home.jsx
+++ b/src/pages/Home.jsx
@@ -1,26 +1,24 @@
+import { useState } from "react";
import Footer from "../components/Footer";
import HeroSection from "../components/HeroSection";
import RecentPosts from "../components/RecentPosts";
+import ExpandedCard from "../components/ExpandedCard";
const Home = () => {
const heroPosts = [
{
- title:
- "Breaking Into Product Design: Advice from Untitled Founder, Frankie",
- description:
- "Learn key strategies to break into the product design field with insights from Frankie.",
+ title: "Breaking Into Product Design: Advice from Untitled Founder, Frankie",
+ description: "Learn key strategies to break into the product design field with insights from Frankie.",
img: "https://images.unsplash.com/photo-1651066471224-b970dd45acc3?q=80&w=1974&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",
},
{
title: "Mastering UX Design: Tips from Industry Experts",
- description:
- "Discover how leading UX designers build intuitive experiences.",
+ description: "Discover how leading UX designers build intuitive experiences.",
img: "https://plus.unsplash.com/premium_photo-1681755915233-9acafb348a7f?q=80&w=2070&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",
},
{
title: "The Importance of Wireframing in UX Design",
- description:
- "How wireframing can streamline your design process and improve outcomes.",
+ description: "How wireframing can streamline your design process and improve outcomes.",
img: "https://images.unsplash.com/photo-1657639466571-15adb5ab7bea?q=80&w=2070&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",
},
];
@@ -68,18 +66,47 @@ const Home = () => {
date: "Mar 10, 2020",
img: "https://plus.unsplash.com/premium_photo-1727537538673-07a31d71efe3?q=80&w=1932&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",
},
- // More posts...
];
+ // State to track the selected post
+ const [selectedPost, setSelectedPost] = useState(null);
+
+ // Handle card click
+ const handleCardClick = (post) => {
+ setSelectedPost(post);
+ };
+
+ // Handle back button click
+ const handleBackClick = () => {
+ setSelectedPost(null);
+ };
+
+ // Get similar posts (for simplicity, we'll just filter out the selected one)
+ const getSimilarPosts = (selectedPost) => {
+ return blogPosts.filter((post) => post.id !== selectedPost.id).slice(0, 3);
+ };
+
return (
- {/* Hero Section with multiple posts */}
-
+ {/* If a post is selected, show the ExpandedCard */}
+ {selectedPost ? (
+
+ ) : (
+ <>
+ {/* Hero Section */}
+
- {/* Recent Blog Posts */}
-
+ {/* Recent Posts Section */}
+
-
+ {/* Footer */}
+
+ >
+ )}
);
};