Add a featured article card that spans the full width of the page

Introduces a new `WideCard` component and integrates it into the home page layout to display a featured article, spanning two columns on larger screens and one on smaller screens.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 517dfa7b-26ac-463d-a6e1-a58c6df97188
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Event-Id: e9899683-2a85-4236-b9a3-24b2669cafd2
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/f209e72a-0939-48fa-84fc-57854de71967/517dfa7b-26ac-463d-a6e1-a58c6df97188/0ZGabQy
Replit-Helium-Checkpoint-Created: true
This commit is contained in:
sebastjanartic 2026-02-28 22:17:31 +00:00
parent 9660529daa
commit 29714c1cd4
2 changed files with 43 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 179 KiB

View File

@ -181,6 +181,41 @@ function MediumCard({ article, focalPoints }: { article: Article; focalPoints?:
); );
} }
function WideCard({ article, focalPoints }: { article: Article; focalPoints?: Record<string, { x: number; y: number }> }) {
const isVideo = article.category === "Video";
const objPos = getObjectPosition(article.coverImage, focalPoints);
return (
<Link href={`/article/${article.slug}`}>
<div className="relative group cursor-pointer rounded-lg overflow-hidden bg-card border border-card-border flex flex-col sm:flex-row h-full" data-testid={`card-wide-${article.id}`}>
<div className="relative flex-shrink-0 sm:w-1/2">
<div className="overflow-hidden h-full">
<img src={thumbUrl(article.coverImage)} alt={article.title} className="w-full h-full aspect-video sm:aspect-auto object-cover transition-transform duration-500 group-hover:scale-105" style={{ objectPosition: objPos, minHeight: "100%" }} loading="lazy" />
</div>
{isVideo && (
<div className="absolute inset-0 flex items-center justify-center">
<div className="w-12 h-12 rounded-full bg-primary/90 flex items-center justify-center group-hover:bg-primary transition-colors">
<Play className="w-5 h-5 text-white ml-0.5" fill="white" />
</div>
</div>
)}
</div>
<div className="p-4 sm:p-5 flex flex-col flex-1 justify-center">
<div className="flex items-center gap-2 mb-2">
<span className="text-xs font-medium text-primary">{article.author}</span>
<span className="text-muted-foreground text-xs">{timeAgo(new Date(article.publishedAt))}</span>
</div>
<h3 className="font-bold text-card-foreground text-lg leading-snug line-clamp-2 group-hover:text-primary transition-colors">{article.title}</h3>
<p className="text-sm text-muted-foreground mt-2 leading-relaxed line-clamp-4 flex-1">{article.excerpt}</p>
<div className="flex items-center gap-2 mt-3 text-muted-foreground text-[10px]">
<Eye className="w-3 h-3" />
{article.views.toLocaleString()}
</div>
</div>
</div>
</Link>
);
}
function BlogCard({ article, focalPoints }: { article: Article; focalPoints?: Record<string, { x: number; y: number }> }) { function BlogCard({ article, focalPoints }: { article: Article; focalPoints?: Record<string, { x: number; y: number }> }) {
const isVideo = article.category === "Video"; const isVideo = article.category === "Video";
const objPos = getObjectPosition(article.coverImage, focalPoints); const objPos = getObjectPosition(article.coverImage, focalPoints);
@ -487,6 +522,14 @@ export default function Home() {
</div> </div>
))} ))}
{shuffled.length > 0 && (
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-2 gap-4">
<div className="sm:col-span-2 lg:col-span-2">
<WideCard article={shuffled[shuffled.length - 1]} focalPoints={focalPoints} />
</div>
</div>
)}
</main> </main>
<Footer /> <Footer />
</div> </div>