Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Navbar, Footer, and Dark Mode Support to What’s Trending Route #556

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 26 additions & 18 deletions src/pages/WhatsTrending/WhatsTrending.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { useEffect, useState } from 'react';
import './WhatsTrending.css'; // Ensure you have the CSS file for styling
import Header from '../../components/Common/Header';

const WhatsTrending = () => {
const [news, setNews] = useState([]);
Expand All @@ -24,31 +25,38 @@ const WhatsTrending = () => {
}, [url]);

return (
<div className="whats-trending">
<h2>What's Trending</h2>
<div className='trend-content'>

{news.map((item) => (
<div key={item.id} className="trending-item">
{/* ..........for image showing........ */}
<div className='trend-image'>
<img src={item.imageurl} alt={item.title} className="trending-image" />
</div>
{/* .............for detail showing......... */}
<div className='details-trend-content'>
<>
<Header />
<div className="whats-trending">
<h2>What's Trending</h2>
<div className='trend-content'>

{news.map((item) => (
<div key={item.id} className="trending-item">
{/* ..........for image showing........ */}
<div className='trend-image'>
<img src={item.imageurl} alt={item.title} className="trending-image" />
</div>
{/* .............for detail showing......... */}
<div className='details-trend-content'>

<h3 className="trending-title">{item.title}</h3>
<p className="trending-body">
{item.body.split(" ").slice(0, 20).join(" ") + (item.body.split(" ").length > 20 ? "..." : "")}
</p>

<p className="trending-published">Published on: {new Date(item.published_on * 1000).toLocaleDateString()}</p>
</div>

<h3 className="trending-title">{item.title}</h3>
<p className="trending-body">{item.body}</p>
<p className="trending-published">Published on: {new Date(item.published_on * 1000).toLocaleDateString()}</p>
</div>

</div>

))}
</div>

))}
</div>

</div>
</>
);
};

Expand Down
Loading