diff --git a/src/components/Blog/newss.jsx b/src/components/Blog/newss.jsx index 7f5f348..ef34cfe 100644 --- a/src/components/Blog/newss.jsx +++ b/src/components/Blog/newss.jsx @@ -1,113 +1,114 @@ -import React, { useEffect, useState } from 'react'; -import "./newss.css"; -import Navbar from '../Navbar'; -import Footer from '../Footer'; -import image1 from "../../assets/news1.jpg" -import image2 from "../../assets/news2.jpg" -import image3 from "../../assets/news3.jpeg" +import React, { useEffect, useState } from "react"; +import "./newss.css"; +import Navbar from "../Navbar"; +import Footer from "../Footer"; +import image1 from "../../assets/news1.jpg"; +import image2 from "../../assets/news2.jpg"; +import image3 from "../../assets/news3.jpeg"; import { color, motion, useScroll } from "framer-motion"; const blogPosts = [ { id: 1, - title: 'Recipe of Phirni by Masterchef Sanjeev Kapoor', - date: '2024-04-30', + title: "Recipe of Phirni by Masterchef Sanjeev Kapoor", + date: "2024-04-30", author: "Niko", image: image1, }, { id: 2, - title: 'Recipe of Phirni by Masterchef Sanjeev Kapoor', - date: '2024-04-26', + title: "Recipe of Phirni by Masterchef Sanjeev Kapoor", + date: "2024-04-26", author: "Niko", image: image1, }, { id: 3, - title: '5 delish gourmet desserts with a savoury twist | Mint', - date: '2024-03-25', + title: "5 delish gourmet desserts with a savoury twist | Mint", + date: "2024-03-25", author: "Niko", image: image3, }, { id: 4, - title: 'Master The Art of Salad Dressing', - date: '2024-04-30', - author: "Niko", + title: "Master The Art of Salad Dressing", + date: "2024-04-30", + author: "Niko", image: image2, }, { id: 5, - title: 'Recipe of Phirni by Masterchef Sanjeev Kapoor', - date: '2024-04-26', - author: "Niko", + title: "Recipe of Phirni by Masterchef Sanjeev Kapoor", + date: "2024-04-26", + author: "Niko", image: image1, }, { id: 6, - title: '5 delish gourmet desserts with a savoury twist | Mint', - date: '2024-03-25', - author: "Niko", + title: "5 delish gourmet desserts with a savoury twist | Mint", + date: "2024-03-25", + author: "Niko", image: image3, }, { id: 7, - title: 'Master The Art of Salad Dressing', - date: '2024-04-30', - author: "Niko", + title: "Master The Art of Salad Dressing", + date: "2024-04-30", + author: "Niko", image: image2, }, { id: 8, - title: 'Recipe of Phirni by Masterchef Sanjeev Kapoor', - date: '2024-04-26', - author: "Niko", + title: "Recipe of Phirni by Masterchef Sanjeev Kapoor", + date: "2024-04-26", + author: "Niko", image: image1, }, { id: 9, - title: '5 delish gourmet desserts with a savoury twist | Mint', - date: '2024-03-25', - author: "Niko", + title: "5 delish gourmet desserts with a savoury twist | Mint", + date: "2024-03-25", + author: "Niko", image: image3, }, { id: 10, - title: 'Master The Art of Salad Dressing', - date: '2024-04-30', - author: "Niko", + title: "Master The Art of Salad Dressing", + date: "2024-04-30", + author: "Niko", image: image2, }, { id: 11, - title: 'Recipe of Phirni by Masterchef Sanjeev Kapoor', - date: '2024-04-26', - author: "Niko", + title: "Recipe of Phirni by Masterchef Sanjeev Kapoor", + date: "2024-04-26", + author: "Niko", image: image1, }, { id: 12, - title: '5 delish gourmet desserts with a savoury twist | Mint', - date: '2024-03-25', + title: "5 delish gourmet desserts with a savoury twist | Mint", + date: "2024-03-25", author: "Niko", image: image3, }, ]; const Newss = () => { - const [searchQuery, setSearchQuery] = useState(''); + const [searchQuery, setSearchQuery] = useState(""); const [filteredPosts, setFilteredPosts] = useState([]); -useEffect(()=>{ - setFilteredPosts([...blogPosts]) -},[blogPosts]) + useEffect(() => { + setFilteredPosts([...blogPosts]); + }, [blogPosts]); const handleSearchChange = (event) => { setSearchQuery(event.target.value); }; const handleSearch = () => { const lowercasedQuery = searchQuery.toLowerCase(); - const newFilteredPosts = blogPosts.filter(post => - post.title.toLowerCase().includes(lowercasedQuery) || - post.author.toLowerCase().includes(lowercasedQuery) + const newFilteredPosts = blogPosts.filter( + (post) => + post.title.toLowerCase().includes(lowercasedQuery) || + post.author.toLowerCase().includes(lowercasedQuery) ); setFilteredPosts(newFilteredPosts); }; @@ -118,57 +119,62 @@ useEffect(()=>{ }; return ( <> - -
-
- {/*

Trending Food and Health News

*/} -
-
- - Trending Food and Health News - -
-
- -
-
-
-
- -
- {filteredPosts.map(post => ( - -
- {post.title} + +
+
+ {/*

Trending Food and Health News

*/} +
+
+ + Trending Food and Health News +
-
-

{post.title}

-

~{post.author}

-

{post.date}

+
+ +
- - ))} +
+
+
+
+ {filteredPosts.map((post) => ( + +
+ {post.title} +
+
+

{post.title}

+

~{post.author}

+

{post.date}

+
+
+ ))} +
+
-
-
-