import Link from "next/link";
import type { CaseStudyBlockValue } from "@/types/wagtail";

export default function CaseStudyCard({ value }: { value: CaseStudyBlockValue }) {
  if (!value.case_page) {
    return null;
  }

  return (
    <div className="mx-auto max-w-3xl px-6 py-8">
      <Link
        href={value.case_page.meta.html_url ?? "#"}
        className="block rounded-3xl border border-slate-100 p-8 shadow-sm transition hover:shadow-md"
      >
        <h3 className="text-xl font-semibold text-slate-900">
          {value.case_page.title}
        </h3>
        {value.summary && (
          <p className="mt-2 text-slate-600">{value.summary}</p>
        )}
      </Link>
    </div>
  );
}
