"use client";

import { useTranslation } from "react-i18next";
import { Button } from "@/components/ui/Button";
import { volunteerStaticData } from "./opportunityListStaticData";
import AssetIcon from "@/components/ui/AssetIcon";
import CoverImage from "@/components/ui/CoverImage";

/**
 * Three filled placeholder cards for the `isStatic` preview.
 *
 * Hard-coded demo content, shown where a design needs a populated grid and no
 * request should be made. Kept apart from the real card so nobody mistakes one
 * for the other, and so the live grid is not read past 40 lines of sample markup.
 */
export default function OpportunityStaticPreviewGrid({
  buttonText,
}: {
  buttonText?: string;
}) {
  const { t } = useTranslation();

  return (

        <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-[25px] mobilescreen:gap-0">
          {volunteerStaticData.map((item) => (
            <div key={item.id} className="">
              {/* `aspect-square` moves onto the wrapper, which the caption
                  bar below is already positioned against — so the card's
                  height no longer depends on the image having loaded. */}
              <div className="relative aspect-square w-full">
                <CoverImage
                  src={item.image}
                  alt={item.title}
                  className="border border-[#484848] border-b-0 rounded-t-[20px] object-cover"
                  sizes="(min-width: 1280px) 25vw, (min-width: 1024px) 33vw, (min-width: 768px) 50vw, 100vw"
                />
                <div className="grid grid-cols-2 text-sm text-gray-600 bg-[#484848] absolute w-full bottom-0 h-[39px] items-center">
                  <span className="flex text-white justify-center gap-2 items-center text-sm">
                    <AssetIcon src="/assets/homepage/dateicn.svg" alt="Date Icon" className="w-4 h-4" size={16} />
                    {item.date}
                  </span>
                  <div className="h-[60%] w-[1px] bg-white absolute left-1/2 top-[8px]"></div>
                  <span className="flex text-white justify-center gap-2 items-center text-sm">
                    <AssetIcon src="/assets/homepage/timeicn.svg" alt="Time Icon" className="w-4 h-4" size={16} />
                    {item.time}
                  </span>
                </div>
              </div>
              <div className="learnserve-boxshaow rounded-b-[20px] border border-primary-5 pb-10 relative bg-[#F7F7F7] min-h-[230px] px-5">
                <h3 className="text-lg text-secondary-100 pb-3 font-bold pt-[19px]">{item.title}</h3>
                <div className="grid grid-cols-2 justify-between pb-[22px]">
                  <p className="flex items-center text-secondary-102 text-sm gap-2 leading-tight">
                    <AssetIcon src="/assets/homepage/hours.svg" alt="Hours" className="w-5 h-5 object-contain" size={20} />
                    {item.hours}
                  </p>
                  <p className="flex items-center text-secondary-102 text-sm gap-2 leading-tight">
                    <AssetIcon src="/assets/homepage/locations.svg" alt="Location" className="w-5 h-5 object-contain" size={20} />
                    <span className="line-clamp-1">{item.location}</span>
                  </p>
                </div>
                <div className="grid grid-cols-2 justify-between text-secondary-102 text-lg">
                  <p className="flex items-center text-secondary-102 text-sm gap-2 leading-tight">
                    <AssetIcon src="/assets/homepage/health.svg" alt="Category" className="w-5 h-5 object-contain" size={20} />
                    {item.category}
                  </p>
                </div>
              </div>
              <Button
                className="bg-primary-5 relative mx-auto flex justify-center border-0 bottom-[25px]"
                variant="primary"
                size="medium"
              >
                {buttonText || t("COMMON.REGISTER")}
              </Button>
            </div>
          ))}
        </div>
  );
}
