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.

remove product hunt popup

Steven Teyadece8fec890
diff --git a/apps/web/app/[domain]/layout.tsx b/apps/web/app/[domain]/layout.tsx
index abfea7e63c..0d67cb836f 100644
--- a/apps/web/app/[domain]/layout.tsx
+++ b/apps/web/app/[domain]/layout.tsx
@@ -1,11 +1,10 @@
-import { Footer, Nav, NavMobile, ProductHunt } from "@dub/ui";
+import { Footer, Nav, NavMobile } from "@dub/ui";
export default function CustomDomainLayout(props) {
return (
<div className="flex min-h-screen flex-col justify-between bg-gray-50">
<NavMobile />
<Nav />
- <ProductHunt />
{props.children}
<Footer />
</div>
diff --git a/apps/web/app/app.dub.co/(auth)/layout.tsx b/apps/web/app/app.dub.co/(auth)/layout.tsx
index 2e72101d4f..df7a5ad971 100644
--- a/apps/web/app/app.dub.co/(auth)/layout.tsx
+++ b/apps/web/app/app.dub.co/(auth)/layout.tsx
@@ -1,4 +1,4 @@
-import { Background, ProductHunt } from "@dub/ui";
+import { Background } from "@dub/ui";
import { ReactNode } from "react";
export const runtime = "edge";
@@ -8,7 +8,6 @@ export default function AuthLayout({ children }: { children: ReactNode }) {
<>
<Background />
<div className="relative z-10 flex h-screen w-screen justify-center">
- <ProductHunt />
{children}
</div>
</>
diff --git a/packages/ui/package.json b/packages/ui/package.json
index ac9e0b8467..63d3f31f54 100644
--- a/packages/ui/package.json
+++ b/packages/ui/package.json
@@ -1,7 +1,7 @@
{
"name": "@dub/ui",
"description": "UI components for Dub.co",
- "version": "0.0.66",
+ "version": "0.0.67",
"sideEffects": false,
"main": "./dist/index.js",
"module": "./dist/index.mjs",
diff --git a/packages/ui/src/product-hunt.tsx b/packages/ui/src/product-hunt.tsx
index b40a21450d..7ab65840a2 100644
--- a/packages/ui/src/product-hunt.tsx
+++ b/packages/ui/src/product-hunt.tsx
@@ -7,14 +7,6 @@ import { useState } from "react";
import { ClientOnly } from "./client-only";
export function ProductHunt() {
- return (
- <ClientOnly>
- <ProductHuntChild />
- </ClientOnly>
- );
-}
-
-function ProductHuntChild() {
const [closed, setClosed] = useState(
Cookies.get("hideProductHuntBanner") === "1",
);
@@ -24,48 +16,53 @@ function ProductHuntChild() {
};
return (
- <AnimatePresence>
- {!closed && (
- <motion.div
- key="product-hunt-banner"
- className="xs:left-4 xs:mx-auto xs:max-w-xs group fixed bottom-4 z-40 mx-2 rounded-lg border border-gray-200 bg-white p-2 pb-4 pr-4 shadow-md"
- initial={{ opacity: 0, y: 50 }}
- animate={{ opacity: 1, y: 0 }}
- exit={{ y: 250 }}
- >
- <div className="invisible absolute right-4 top-4 h-3 w-3 group-hover:invisible sm:visible">
- <div className="absolute inset-0 m-auto h-3 w-3 animate-ping items-center justify-center rounded-full bg-green-500" />
- <div className="absolute inset-0 z-10 m-auto h-3 w-3 rounded-full bg-green-500" />
- </div>
- <button
- className="visible absolute right-2.5 top-2.5 rounded-full p-1 transition-colors hover:bg-gray-100 active:scale-90 group-hover:visible sm:invisible"
- onClick={handleClose}
- >
- <X className="h-4 w-4 text-gray-500" />
- </button>
- <Link
- href="https://d.to/ph?utm_source=badge-featured&utm_medium=badge&utm_souce=badge-dub"
- target="_blank"
- >
- <Image
- src="https://assets.dub.co/misc/product-hunt.png"
- alt="Product Hunt"
- width={100}
- height={100}
- className="h-24"
- />
- <div className="-mt-2 px-4">
- <p className="mb-1 font-medium text-gray-800">
- We're live on Product Hunt!
- </p>
- <p className="text-sm text-gray-500 underline-offset-4 transition-all group-hover:text-gray-800 group-hover:underline">
- Join the conversation and help us get to #1 Product of the Month
- ↗
- </p>
- </div>
- </Link>
- </motion.div>
- )}
- </AnimatePresence>
+ <ClientOnly>
+ <AnimatePresence>
+ {!closed && <ProductHuntPopup handleClose={handleClose} />}
+ </AnimatePresence>
+ </ClientOnly>
+ );
+}
+
+export function ProductHuntPopup({ handleClose }: { handleClose: () => void }) {
+ return (
+ <motion.div
+ key="product-hunt-banner"
+ className="xs:left-4 xs:mx-auto xs:max-w-xs group fixed bottom-4 z-40 mx-2 rounded-lg border border-gray-200 bg-white p-2 pb-4 pr-4 shadow-md"
+ initial={{ opacity: 0, y: 50 }}
+ animate={{ opacity: 1, y: 0 }}
+ exit={{ y: 250 }}
+ >
+ <div className="invisible absolute right-4 top-4 h-3 w-3 group-hover:invisible sm:visible">
+ <div className="absolute inset-0 m-auto h-3 w-3 animate-ping items-center justify-center rounded-full bg-green-500" />
+ <div className="absolute inset-0 z-10 m-auto h-3 w-3 rounded-full bg-green-500" />
+ </div>
+ <button
+ className="visible absolute right-2.5 top-2.5 rounded-full p-1 transition-colors hover:bg-gray-100 active:scale-90 group-hover:visible sm:invisible"
+ onClick={handleClose}
+ >
+ <X className="h-4 w-4 text-gray-500" />
+ </button>
+ <Link
+ href="https://d.to/ph?utm_source=badge-featured&utm_medium=badge&utm_souce=badge-dub"
+ target="_blank"
+ >
+ <Image
+ src="https://assets.dub.co/misc/product-hunt.png"
+ alt="Product Hunt"
+ width={100}
+ height={100}
+ className="h-24"
+ />
+ <div className="-mt-2 px-4">
+ <p className="mb-1 font-medium text-gray-800">
+ We're live on Product Hunt!
+ </p>
+ <p className="text-sm text-gray-500 underline-offset-4 transition-all group-hover:text-gray-800 group-hover:underline">
+ Join the conversation and help us get to #1 Product of the Month ↗
+ </p>
+ </div>
+ </Link>
+ </motion.div>
);
}