import type { ComponentType } from "react";
import { socialLinks, type SocialId } from "@/content/site";
import { FacebookIcon, InstagramIcon, LinkedinIcon, WhatsappIcon, XIcon, type IconProps } from "@/components/icons";

const icons: Record<SocialId, ComponentType<IconProps>> = {
  facebook: FacebookIcon,
  x: XIcon,
  instagram: InstagramIcon,
  linkedin: LinkedinIcon,
  whatsapp: WhatsappIcon,
};

export function SocialLinks() {
  return (
    <ul className="flex items-center gap-4">
      {socialLinks.map(({ id, label, href }) => {
        const Icon = icons[id];
        return (
          // Figma shows WhatsApp only in the desktop footer (phone & tablet frames have 4 icons).
          <li key={id} className={id === "whatsapp" ? "max-lg:hidden" : undefined}>
            <a
              href={href}
              aria-label={label}
              target="_blank"
              rel="noopener noreferrer"
              className="flex size-6 items-center justify-center text-soft transition hover:text-white max-md:[&_svg]:size-[18px]"
            >
              <Icon className="max-h-6 max-w-6" />
            </a>
          </li>
        );
      })}
    </ul>
  );
}
