Skip to content

Commit

Permalink
Added analytics handler
Browse files Browse the repository at this point in the history
  • Loading branch information
bring-shrubbery committed Mar 22, 2024
1 parent 869fcd2 commit 3b0c183
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions apps/nextjs/src/components/announcement-bar.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"use client";

import { MouseEventHandler } from "react";
import Link from "next/link";
import { atom, useAtom } from "jotai";
import { XIcon } from "lucide-react";
Expand All @@ -22,7 +23,11 @@ export const AnnouncementBar = ({ adsEnabled }: { adsEnabled: boolean }) => {
display: announcementBarHidden ? "none" : "block",
}}
>
{adsEnabled ? <Banner2 /> : <Banner1 />}
{adsEnabled ? (
<Banner2 onClick={() => analytics.track("banner_ad_quassum_design")} />
) : (
<Banner1 />
)}
<span
className="absolute right-0 top-0 flex h-full items-center px-2"
onClick={() => {
Expand Down Expand Up @@ -59,14 +64,19 @@ const Banner1 = () => {
);
};

const Banner2 = () => {
const Banner2 = ({
onClick,
}: {
onClick: MouseEventHandler<HTMLAnchorElement>;
}) => {
return (
<p className="mx-auto w-fit px-8 text-center text-sm">
Looking for a gift for a classy friend? 🎁 Check out our 3D printing
store:{" "}
<Link
href="http://quassum.design/"
className="font-normal text-blue-500 visited:text-purple-700 hover:text-blue-600 active:text-blue-700 dark:text-blue-300 dark:visited:text-purple-300 dark:hover:text-blue-400 dark:active:text-blue-200"
onClick={onClick}
>
quassum.design
</Link>
Expand Down

0 comments on commit 3b0c183

Please sign in to comment.