From 913844dfc5bdf5ee5c90077138773bffb9985cd1 Mon Sep 17 00:00:00 2001 From: Sawan Date: Sat, 2 Nov 2024 17:19:21 +0530 Subject: [PATCH] enchanced the UI of blog page to look for beautiful --- client/src/component/Blog.jsx | 181 +++++++++------------------------- 1 file changed, 45 insertions(+), 136 deletions(-) diff --git a/client/src/component/Blog.jsx b/client/src/component/Blog.jsx index 7927443..fa65718 100644 --- a/client/src/component/Blog.jsx +++ b/client/src/component/Blog.jsx @@ -1,6 +1,6 @@ import { useEffect, useState } from "react"; - +import PropTypes from 'prop-types'; import { Search } from "lucide-react"; import { Link } from "react-router-dom"; @@ -13,89 +13,6 @@ import img4 from "../assets/blogs/4.jpeg"; import img5 from "../assets/blogs/5.jpeg"; import img6 from "../assets/blogs/6.png"; - - -// import { Link } from 'react-router-dom'; -import "../css/Home.css"; - -// Dummy blog data - -const blogPosts = [ - { - id: 1, - title: "The Art of Modern Web Design", - author: "Sarah Chen", - date: "March 15, 2024", - category: "Design", - readTime: "5 min read", - image: img1, - excerpt: - "Exploring the latest trends in web design and how they shape user experiences in the digital age.", - tags: ["Design", "Web", "UI/UX"], - }, - { - id: 2, - title: "Understanding React Hooks", - author: "James Wilson", - date: "March 18, 2024", - category: "Development", - readTime: "8 min read", - image: img2, - excerpt: - "A deep dive into React Hooks and how they're revolutionizing the way we build components.", - tags: ["React", "JavaScript", "Programming"], - }, - { - id: 3, - title: "The Future of AI in Design", - author: "Elena Martinez", - date: "March 20, 2024", - category: "AI", - readTime: "6 min read", - image: img3, - excerpt: - "How artificial intelligence is transforming the design industry and what it means for creators.", - tags: ["AI", "Design", "Technology"], - }, - { - id: 4, - title: "Building Sustainable Tech", - author: "Alex Kumar", - date: "March 22, 2024", - category: "Technology", - readTime: "7 min read", - image: img4, - excerpt: - "Exploring eco-friendly approaches to software development and digital infrastructure.", - tags: ["Sustainability", "Technology", "Green Computing"], - }, - { - id: 5, - title: "The Psychology of UX Design", - author: "Maya Patel", - date: "March 25, 2024", - category: "UX", - readTime: "10 min read", - image: img5, - excerpt: - "Understanding how human psychology influences user experience design decisions.", - tags: ["UX", "Psychology", "Design"], - }, - { - id: 6, - title: "Mobile-First Development", - author: "Thomas Anderson", - date: "March 27, 2024", - category: "Development", - readTime: "6 min read", - image: img6, - excerpt: - "Best practices for building responsive applications with a mobile-first approach.", - tags: ["Mobile", "Development", "Responsive"], - }, -]; - - const images = [ { src: img1, category: "Web Development" }, { src: img2, category: "Mobile Development" }, @@ -104,7 +21,12 @@ const images = [ { src: img4, category: "AI" }, { src: img3, category: "Cybersecurity" }, ]; -export default function BlogPage() { + +BlogPage.propTypes = { + mode: PropTypes.string.isRequired, + +}; +export default function BlogPage(props) { const [searchTerm, setSearchTerm] = useState(""); const [selectedCategory, setSelectedCategory] = useState("All"); const [blogPosts, setblogPosts] = useState([]); @@ -191,11 +113,10 @@ export default function BlogPage() { @@ -209,59 +130,47 @@ export default function BlogPage() { {/* Blog Grid */} -
+
{filteredPosts.length > 0 ? ( - filteredPosts.map((post) => ( -
+ filteredPosts.map((blogPost) => ( + +
{post.title} { e.target.onerror = null; e.target.src = '/placeholder.svg'; }} />
-
- - {post.category} - - - {post.readTime} +

{blogPost.title}

+
+ + + + + + + + {blogPost.category}
-

- {post.title} -

- -

- {post.excerpt} -

-
- - -
-
-
-
-

- {post.author} -

- -

- {formatDate(post.date)} -

-
-
- -
-
+
+ + + + + Read More + +
+
+ + )) ) : (
@@ -288,7 +197,7 @@ export default function BlogPage() { Page not found

- The page you are looking for doesn't exist. Here are some + The page you are looking for doesnt exist. Here are some helpful links: