import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faGithub } from "@fortawesome/free-brands-svg-icons";
import { faCodeBranch } from "@fortawesome/free-solid-svg-icons";
import giteaLogo from "../assets/gitea.png";
import gitlabLogo from "../assets/gitlab.png";

export function RepoIcon({ repoUrl }: { repoUrl: string }) {
  const lower = repoUrl.toLowerCase();
  if (lower.includes("github.com")) return <FontAwesomeIcon icon={faGithub} className="h-6 w-6 text-foreground" />;
  if (lower.includes("gitlab")) return <img src={gitlabLogo} alt="GitLab" className="h-6 w-6 object-contain" />;
  if (lower.includes("gitea")) return <img src={giteaLogo} alt="Gitea" className="h-6 w-6 object-contain" />;
  return <FontAwesomeIcon icon={faCodeBranch} className="h-6 w-6 text-foreground" />;
}
