Skip to content

armgit / mapcn

Public Imported from GitHub
0

Beautiful map components. 100% Free, Zero config, one command setup.

TypeScript
1015 B
Raw Blame
"use client";

import { Button } from "@/components/ui/button";
import { trackEvent } from "@/lib/events";
import { getSponsorAction, type SponsorTier } from "@/lib/sponsors";

interface SponsorContactButtonProps extends Omit<
  React.ComponentProps<typeof Button>,
  "asChild" | "onClick"
> {
  tier?: SponsorTier;
}

export function SponsorContactButton({
  tier,
  children,
  ...props
}: SponsorContactButtonProps) {
  const action = getSponsorAction(tier);

  return (
    <Button asChild {...props}>
      <a
        href={action.href}
        target={action.kind === "checkout" ? "_blank" : undefined}
        rel={action.kind === "checkout" ? "noopener noreferrer" : undefined}
        onClick={() =>
          trackEvent({
            name:
              action.kind === "checkout"
                ? "click_sponsor_checkout"
                : "click_sponsor_contact",
            properties: { tier: tier?.id ?? "custom" },
          })
        }
      >
        {children}
      </a>
    </Button>
  );
}