interface CountryFlagProps {
  code: string;
  size?: "sm" | "md";
}

export function CountryFlag({ code, size = "sm" }: CountryFlagProps) {
  const cc = code.toLowerCase();
  const dimensions = size === "sm" ? "h-3.5 w-5" : "h-4 w-6";

  return (
    <img
      src={`https://flagcdn.com/w40/${cc}.png`}
      srcSet={`https://flagcdn.com/w80/${cc}.png 2x`}
      alt=""
      className={`${dimensions} shrink-0 rounded-sm object-cover shadow-sm`}
      loading="lazy"
    />
  );
}
