"use client";

import OpportunitySponsors from "../OpportunitySponsors";
import type { OpportunitySponsorImage } from "./types";

/** The opportunity's own sponsors, in the organizer column. */
export default function SponsorsCard({
  sponsors,
}: {
  sponsors?: OpportunitySponsorImage[];
}) {
  if (!sponsors?.length) return null;

  return (
    <div className="sponseritm relative my-5 w-full rounded-3xl bg-[#F7F7FB] px-3 py-5 [&_h2]:mb-4 [&_h2]:text-base">
      <OpportunitySponsors
        sponsors={sponsors.map((sponsor) => ({
          id: Number(sponsor.id),
          image: sponsor.image,
          organization: sponsor.organization,
          position: sponsor.position,
        }))}
      />
    </div>
  );
}
