Skip to content

Blog 2

Featured blog post next to a list of recent articles.

02 / 02

Installation

Run this in a project that already uses shadcn/ui. The CLI adds the block, its components and npm dependencies.

pnpm dlx shadcn@latest add https://ui.sumansharma.info.np/r/blog-2.json
Prefer to iterate with AI?Open in

Usage

The CLI writes the block to components/blog-2.tsx. Import it anywhere:

Loading...

Source

The CLI writes this component to components/blog-2.tsx.

import Link from 'next/link'
import { ArrowRight } from 'lucide-react'

const featured = {
    title: 'Why we rebuilt our editor from scratch',
    excerpt: 'Two years of patches had made every change risky. This is the story of the rewrite: the architecture, the migration, and the parts we would do differently.',
    category: 'Engineering',
    date: 'Nov 12, 2026',
    readTime: '12 min read',
    image: 'https://images.unsplash.com/photo-1517694712202-14dd9538aa97?auto=format&fit=crop&w=1400&q=80',
}

const posts = [
    { title: 'Pricing pages that answer questions', category: 'Growth', date: 'Nov 8, 2026' },
    { title: 'A practical guide to accessible forms', category: 'Design', date: 'Nov 1, 2026' },
    { title: 'Incident review: the 14-minute outage', category: 'Infrastructure', date: 'Oct 27, 2026' },
    { title: 'Hiring your first designer', category: 'Company', date: 'Oct 18, 2026' },
]

export default function BlogSection() {
    return (
        <section className="py-16 md:py-24">
            <div className="mx-auto max-w-6xl px-6">
                <h2 className="text-4xl font-semibold lg:text-5xl">Latest writing</h2>

                <div className="mt-12 grid gap-10 lg:grid-cols-[minmax(0,1.4fr)_minmax(0,1fr)] lg:gap-14">
                    <article className="group relative">
                        <div className="bg-muted aspect-[16/9] overflow-hidden rounded-2xl">
                            <img
                                src={featured.image}
                                alt=""
                                className="size-full object-cover transition-transform duration-700 group-hover:scale-[1.03]"
                            />
                        </div>
                        <p className="text-muted-foreground mt-6 text-xs font-medium uppercase tracking-wider">
                            Featured · {featured.category}
                        </p>
                        <h3 className="mt-2 text-balance text-2xl font-semibold leading-tight sm:text-3xl">
                            <Link href="#">
                                <span className="absolute inset-0" />
                                {featured.title}
                            </Link>
                        </h3>
                        <p className="text-muted-foreground mt-3 text-pretty">{featured.excerpt}</p>
                        <p className="text-muted-foreground mt-4 text-sm">
                            <time>{featured.date}</time> · {featured.readTime}
                        </p>
                    </article>

                    <div>
                        <ul className="divide-y border-y">
                            {posts.map((post) => (
                                <li key={post.title}>
                                    <article className="group relative py-6">
                                        <p className="text-muted-foreground flex items-center gap-2 text-xs">
                                            <span className="text-foreground font-medium">{post.category}</span>
                                            <span aria-hidden>·</span>
                                            <time>{post.date}</time>
                                        </p>
                                        <h3 className="mt-2 flex items-start justify-between gap-4 font-medium">
                                            <Link href="#">
                                                <span className="absolute inset-0" />
                                                {post.title}
                                            </Link>
                                            <ArrowRight className="text-muted-foreground group-hover:text-foreground mt-0.5 size-4 shrink-0 -translate-x-1 transition-all group-hover:translate-x-0" />
                                        </h3>
                                    </article>
                                </li>
                            ))}
                        </ul>
                        <Link
                            href="#"
                            className="mt-6 inline-flex text-sm font-medium underline-offset-4 hover:underline">
                            Browse the archive
                        </Link>
                    </div>
                </div>
            </div>
        </section>
    )
}