Skip to content

Commit e799f42

Browse files
authored
Merge pull request #210 from Anuran12/blog-page
Hacktoberfest-2022 Update blog page by @Anuran12
2 parents b8b255c + 836a83e commit e799f42

File tree

1 file changed

+56
-21
lines changed

1 file changed

+56
-21
lines changed

src/pages/blog.js

Lines changed: 56 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,69 @@
11
import Head from 'next/head';
22
// import { Blogs } from '../components/Global'
33

4-
export default function Blog({ articles }) {
4+
export const getStaticProps = async () => {
5+
const res = await fetch('https://dev.to/api/articles?username=webxdao');
6+
const data = await res.json();
7+
8+
return {
9+
props: {
10+
data,
11+
},
12+
};
13+
};
14+
15+
const blog = ({ data }) => {
516
return (
617
<>
718
<Head>
819
<title>Blog | WebXDAO</title>
920
</Head>
10-
{/* <section className='text-white text-center bg-[#00007F]'>
11-
<div className='px-20 py-20'>
12-
<h1 className='font-bold text-5xl antialiased'>Check out our blog posts</h1>
13-
<div className='mt-6 text-xl font-light text-true-gray-500 antialiased'>
14-
Read our articles from <span className='font-mono'>Dev.to</span>
21+
<section className="py-8">
22+
23+
<div className="container max-w-5xl mx-auto">
24+
<h1 className="w-full my-2 text-4xl font-bold leading-tight text-center text-white">
25+
Blogs
26+
</h1>
27+
<div className="w-full mb-4">
28+
<div className="h-1 mx-auto gradient w-64 opacity-25 my-0 py-0 rounded-t"></div>
1529
</div>
1630
</div>
17-
<Blogs articles={articles} contentOnly={true} />
18-
</section> */}
31+
32+
<div className="absolute top-40 -left-16 xl:w-96 xl:h-96 bg-gradient-to-t from-[#1BFFFF] to-[#2E3192] rounded-full"></div>
33+
<div className="absolute top-96 -right-80 xl:w-[50rem] xl:h-[50rem] bg-gradient-to-t from-[#FBB03B] to-[#D4145A] rounded-full"></div>
34+
35+
<section>
36+
<div className="relative grid grid-cols-1 sm:grid-cols-2 z-2 flex justify-center items-center flex-wrap my-7 mx-0">
37+
38+
{data.map((curElem) => {
39+
return (
40+
<div className="grid-items group z-2 relative w-min h-min bg-white bg-opacity-5 m-10 shadow-2xl rounded-2xl flex justify-conten items-center backdrop-filter backdrop-blur-md" key={curElem.id}>
41+
<div className="relative w-[17.5rem] sm:w-[15.5rem] md:w-[19rem] lg:w-[27rem] xl:w-[35rem] h-80 flex justify-center items-center flex-col opacity-70 hover:opacity-100">
42+
43+
<div className="relative w-4/5 rounded-2xl truncate border-8 border-solid border-black/25 group-hover:-translate-y-6 duration-500">
44+
<img src={curElem.cover_image} alt="blog image" className="relative top-0 left-0 w-full h-full object-cover" />
45+
</div>
46+
<div className="relative justify-center items-center flex-wrap mx-0 my-0 text-center">
47+
<h3 className="group-hover:-translate-y-6 duration-500 text-white uppercase font-medium text-sm text-center tracking-wider mt-5 mr-2.5 ml-2.5 mb-2.5 leading-4">
48+
<b>{curElem.title}</b>
49+
<br></br><br></br>
50+
<spam className="text-xs font-light lowercase">
51+
{curElem.description}
52+
</spam>
53+
<a href={curElem.url} target="_blank" rel="noopener noreferrer" className="rounded-md bg-green-500 pl-4 pr-4 text-base font-normal mb-0 mt-0 m-auto">
54+
<b>Read</b>
55+
</a>
56+
</h3>
57+
</div>
58+
</div>
59+
</div>
60+
);
61+
})}
62+
</div>
63+
</section>
64+
</section>
1965
</>
20-
);
66+
)
2167
}
2268

23-
export async function getStaticProps() {
24-
const res = await fetch('https://dev.to/api/articles?username=webxdao', {
25-
method: 'GET',
26-
});
27-
const articles = await res.json();
28-
return {
29-
props: {
30-
articles,
31-
},
32-
revalidate: 10,
33-
};
34-
}
69+
export default blog;

0 commit comments

Comments
 (0)