Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

997 B
Raw Blame
import { cn } from "@dub/utils";
import { DubAnalyticsIcon } from "./dub-analytics";
import { DubApiIcon } from "./dub-api";
import { DubLinksIcon } from "./dub-links";

const icons = {
  links: {
    icon: DubLinksIcon,
    className: "text-orange-900 bg-orange-400",
  },
  analytics: {
    icon: DubAnalyticsIcon,
    className: "text-green-900 bg-green-400",
  },
  api: {
    icon: DubApiIcon,
    className: "text-neutral-900 bg-neutral-400",
  },
};

export type DubProduct = keyof typeof icons;

export function DubProductIcon({
  product,
  className,
  iconClassName,
}: {
  product: keyof typeof icons;
  className?: string;
  iconClassName?: string;
}) {
  const { icon: Icon, className: productClassName } = icons[product];

  return (
    <span
      className={cn(
        "flex size-4 items-center justify-center rounded border border-black/5",
        productClassName,
        className,
      )}
    >
      <Icon className={cn("size-2.5", iconClassName)} />
    </span>
  );
}