import type { SocialLink } from "@/data/content";

type Props = {
  type: SocialLink["icon"];
};

export default function LinkIcon({ type }: Props) {
  const s = {
    width: 18,
    height: 18,
    strokeWidth: 1.5,
    stroke: "currentColor",
    fill: "none" as const,
  };

  if (type === "gh")
    return (
      <svg {...s} viewBox="0 0 24 24">
        <path
          d="M12 2C6.477 2 2 6.477 2 12c0 4.42 2.865 8.166 6.839 9.489.5.092.682-.217.682-.482 0-.237-.009-.866-.013-1.7-2.782.604-3.369-1.34-3.369-1.34-.454-1.156-1.11-1.463-1.11-1.463-.908-.62.069-.608.069-.608 1.003.07 1.531 1.03 1.531 1.03.892 1.529 2.341 1.087 2.91.831.092-.646.35-1.086.636-1.336-2.22-.253-4.555-1.11-4.555-4.943 0-1.091.39-1.984 1.029-2.683-.103-.253-.446-1.27.098-2.647 0 0 .84-.269 2.75 1.025A9.578 9.578 0 0112 6.836a9.59 9.59 0 012.504.337c1.909-1.294 2.747-1.025 2.747-1.025.546 1.377.203 2.394.1 2.647.64.699 1.028 1.592 1.028 2.683 0 3.842-2.339 4.687-4.566 4.935.359.309.678.919.678 1.852 0 1.336-.012 2.415-.012 2.743 0 .267.18.578.688.48C19.138 20.163 22 16.418 22 12c0-5.523-4.477-10-10-10z"
          fill="currentColor"
          stroke="none"
        />
      </svg>
    );

  if (type === "li")
    return (
      <svg {...s} viewBox="0 0 24 24">
        <path d="M16 8a6 6 0 016 6v7h-4v-7a2 2 0 00-4 0v7h-4v-7a6 6 0 016-6z" />
        <rect x="2" y="9" width="4" height="12" />
        <circle cx="4" cy="4" r="2" />
      </svg>
    );

  if (type === "x")
    return (
      <svg {...s} viewBox="0 0 24 24">
        <path d="M4 4l6.5 8L4 20h2l5.5-6.8L16 20h4l-6.8-8.5L19.5 4h-2l-5 6.2L8 4H4z" />
      </svg>
    );

  if (type === "dev")
    return (
      <svg {...s} viewBox="0 0 24 24">
        <rect x="2" y="4" width="20" height="16" rx="2" />
        <text
          x="12"
          y="15"
          textAnchor="middle"
          fontSize="7"
          fontWeight="bold"
          fill="currentColor"
          stroke="none"
          fontFamily="monospace"
        >
          DEV
        </text>
      </svg>
    );

  return null;
}
