51
loading...
This website collects cookies to deliver better user experience
npx create-next-app -e with-tailwindcss my-project
cd my-project
import Head from "next/head";
export default function Home() {
return (
<div>
<Head>
<title>Blog PostCard Tutorial</title>
<link rel="./favicon.ico" />
</Head>
</div>
);
}
const BlogPostCard = () => {
return (
<div className="">
{/* Gradient background of same width & height as Blog post card */}
<div className="">
<div className="">
<div className="">
{/* PostImage */}
<img src="/postImage.png" className="" />
{/* Post title */}
<h1 className="">
This is first title.
</h1>
{/* Post Data/excerpt */}
<p className=" ">
Everything I Know About Style Guides, Design Systems, and
Component Libraries
</p>
</div>
{/* Author image with data */}
<div className="">
<span>
<img
src="/author.jpg"
className=" "
/>
</span>
<p className="">
16 Nov, 2021
</p>
</div>
</div>
</div>
</div>
);
};
export default BlogPostCard;
const BlogPostCard = () => {
return (
<div className="relative flex w-1/4 h-[500px] mx-auto mt-10">
{/* Gradient background of same width & height as Blog post card */}
<div className=" rounded-xl w-full bg-gradient-to-r p-[5px] from-[#7928ca] to-[#ff0080]">
<div className="flex flex-col justify-between h-full bg-black rounded-lg p-4">
<div className="flex flex-col justify-center text-white">
{/* PostImage */}
<img src="/postImage.png" className="h-52 mb-5 rounded-lg" />
{/* Post title */}
<h1 className="text-3xl font-extrabold mb-4">
This is first title.
</h1>
{/* Post Data/excerpt */}
<p className="text-lg md:text-lg font-medium mb-6 ">
Everything I Know About Style Guides, Design Systems, and
Component Libraries
</p>
</div>
{/* Author image with data */}
<div className=" flex w-full justify-between mb-4">
<span>
<img
src="/author.jpg"
className="w-[75px] h-[80px] rounded-full "
/>
</span>
<p className="text-lg mr-5 font-semibold text-white flex items-center justify-center">
16 Nov, 2021
</p>
</div>
</div>
</div>
</div>
);
};
export default BlogPostCard;
import Head from "next/head";
import BlogPostCard from "../components/BlogPostCard";
export default function Home() {
return (
<div className="bg-black flex flex-col min-h-screen py-2">
<Head>
<title>Blog PostCard Tutorial</title>
<link rel="./favicon.ico" />
</Head>
<h1 className="text-8xl font-bold text-indigo-500 mb-10 text-center">Blog PostCard Tutorial</h1>
<div>
<BlogPostCard />
</div>
</div>
);
}
<div>
<div>
</div>
<div>
<div className="rounded-xl w-52 h-64 mx-auto mt-10 bg-gradient-to-r p-[6px] from-[#6EE7B7] via-[#3B82F6] to-[#9333EA]">
<div className="flex flex-col justify-between h-full bg-white text-white rounded-lg p-4">
</div>
</div>