import Link from "next/link";
import { NewsDetails } from "@/services/NewsDetails"; // Ensure the correct import

export default function NewsSection() {
  return (
    <section className="py-16 bg-white">
      <div className="container mx-auto px-6 lg:px-12">
        <div className="grid grid-cols-1 lg:grid-cols-12 gap-8 items-start">
          <div className="lg:col-span-2">
            <h2 className="text-3xl md:text-4xl font-bold text-blue-600 mb-2">NEWS</h2>
            <hr className="w-12 border-t-2 border-blue-600" />
          </div>
          <div className="lg:col-span-10">
            <div className="space-y-8 mb-8">
              {NewsDetails.map((news) => ( // Use the correct variable name
                <Link href={`/NewsDetails/${news.id}`} key={news.id}>
                  <div className="flex justify-between items-center border-b pb-6 cursor-pointer hover:bg-gray-100 transition">
                    <div className="flex items-center space-x-3">
                      <span className="bg-blue-600 text-white text-xs font-semibold px-3 py-1 rounded-full">
                        {news.category}
                      </span>
                      <span className="text-gray-400 text-sm">{news.date}</span>
                    </div>
                    <h3 className="text-lg font-bold text-black">{news.title}</h3>
                  </div>
                </Link>
              ))}
            </div>
            <div className="flex justify-end items-center space-x-4">
              <div className="w-12 h-12 bg-blue-600 rounded-full flex items-center justify-center">
                <span className="text-white text-lg">→</span>
              </div>
              <span className="font-semibold text-black">一覧をみる</span>
            </div>
          </div>
        </div>
      </div>
    </section>
  );
}
