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

Feat/hng 26 latest article card component #221

67 changes: 67 additions & 0 deletions app/components/article/LatestArticle.tsx
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use global styles

Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import { Link } from "@remix-run/react";

interface articleProperties {
id: string;
title: string;
description: string;
profileImage: string;
name: string;
time: string;
creationDate: string;
image: string;
link: string;
tag: string;
}

export default function LatestArticle({
article,
}: {
article: articleProperties;
}) {
return (
<Link to={article.link}>
<article className="max-w-[792px] bg-[#fafafa] text-muted-foreground">
<div className="grid gap-6 py-4 md:grid-cols-5 md:py-8">
<div className="order-2 space-y-2 md:order-1 md:col-span-3 md:space-y-4">
<span className="inline-flex items-center justify-center gap-1.5 rounded-full bg-border py-1 pl-2.5 pr-3 text-xs font-[700]">
<span className="h-2 w-2 rounded-full bg-black"></span>
<div className="uppercase">{article.tag}</div>
</span>

<h3 className="text-xl font-[700] capitalize leading-[normal] tracking-wider md:text-3xl md:font-[600]">
{article.title}
</h3>

<p className="text-base font-[400] leading-[normal] tracking-wide md:text-lg">
{article.description}
</p>

<div className="flex flex-wrap items-center gap-4 text-base font-[500] md:justify-between md:gap-0 md:text-lg">
<div className="order-3 flex w-full items-center gap-3 md:order-1 md:w-auto">
<img
src={article.profileImage}
alt={article.name}
className="h-8 w-8 rounded-full object-cover object-top md:h-10 md:w-10"
/>
<p className="">{article.name}</p>
</div>
<p className="order-1 md:order-2">{article.time} Read</p>

<p className="order-2 flex items-center justify-center gap-4 md:order-3">
<span className="h-2 w-2 rounded-full bg-border"></span>
<span>{article.creationDate}</span>
</p>
</div>
</div>
<div className="order-1 flex md:order-2 md:col-span-2 md:items-end">
<img
src={article.image}
alt={article.title}
className="md:rounded-2 h-60 w-full rounded-lg object-cover md:h-60"
/>
</div>
</div>
</article>
</Link>
);
}
Loading