The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Update domain landing hero
Tim Wilsonaa00e65b259e
diff --git a/apps/web/app/[domain]/browser-graphic.tsx b/apps/web/app/[domain]/browser-graphic.tsxnew file mode 100644index 0000000000..37a155841a--- /dev/null+++ b/apps/web/app/[domain]/browser-graphic.tsx@@ -0,0 +1,31 @@+"use client";++import { cn } from "@dub/utils";++export function BrowserGraphic({ domain }: { domain: string }) {+ return (+ <div className="w-full p-1 [mask-image:linear-gradient(black_50%,transparent_90%)]">+ <div className="w-full rounded-t-lg border border-neutral-300 ring ring-black/5">+ <div className="flex items-center justify-between gap-4 rounded-t-[inherit] bg-white px-5 py-3">+ <div className="hidden grow basis-0 items-center gap-2 sm:flex">+ {["bg-red-400", "bg-yellow-400", "bg-green-400"].map((c) => (+ <div+ key={c}+ className={cn(+ "size-[11px] rounded-full border border-black/10",+ c,+ )}+ />+ ))}+ </div>+ <div className="relative min-w-0 grow truncate rounded-lg bg-[radial-gradient(60%_80%_at_50%_0%,#ddd,#f5f5f5)] px-4 py-2 text-sm font-medium leading-none">+ <div className="absolute inset-x-0 top-0 h-px bg-[linear-gradient(90deg,transparent,#0001,transparent)]" />+ {domain}+ </div>+ <div className="hidden grow basis-0 sm:block" />+ </div>+ <div className="h-12 border-t border-neutral-200 bg-neutral-100/50" />+ </div>+ </div>+ );+}diff --git a/apps/web/app/[domain]/bubble-icon.tsx b/apps/web/app/[domain]/bubble-icon.tsxnew file mode 100644index 0000000000..63f158d766--- /dev/null+++ b/apps/web/app/[domain]/bubble-icon.tsx@@ -0,0 +1,77 @@+"use client";++import { Icon } from "@dub/ui";+import { CSSProperties, RefObject, useEffect, useRef, useState } from "react";++export function BubbleIcon({ icon: Icon }: { icon: Icon }) {+ const ref = useRef<HTMLDivElement>(null);+ const position = useRelativeMousePosition(ref);++ return (+ <div+ ref={ref}+ className="rounded-full [perspective:500px]"+ style={+ {+ "--mx": position.x ?? 0.5,+ "--my": position.y ?? 0.5,+ filter: `+ drop-shadow(0 3px 6px #5242511A)+ drop-shadow(0 12px 12px #52425117)+ drop-shadow(0 26px 16px #5242510D)+ drop-shadow(0 47px 19px #52425103)+ drop-shadow(0 73px 20px #52425100)+ `,+ } as CSSProperties+ }+ >+ <div+ className="relative rounded-full bg-gradient-to-b from-neutral-100 to-neutral-300 p-px transition-[transform] duration-[50ms]"+ style={{+ transform: `rotateY(clamp(-20deg, calc(var(--mx) * 4deg), 20deg)) rotateX(clamp(-20deg, calc(var(--my) * -4deg), 20deg))`,+ }}+ >+ <div className="rounded-full bg-gradient-to-b from-white to-neutral-100 p-8">+ <Icon className="size-10" />+ </div>++ <div className="absolute inset-0 rounded-full bg-gradient-to-t from-[#fff8]" />++ <div+ className="absolute inset-0 rounded-full opacity-70 blur-sm"+ style={{+ backgroundImage: `+ radial-gradient(circle at 0% 100%, #ffdbe5, transparent 40%),+ radial-gradient(circle at 50% 120%, #c8cff8, transparent 30%),+ radial-gradient(circle at 100% 100%, #ccfac8, transparent 40%)+ `,+ }}+ />+ </div>+ </div>+ );+}++function useRelativeMousePosition(ref: RefObject<HTMLElement>) {+ const [position, setPosition] = useState<{+ x: number | null;+ y: number | null;+ }>({ x: null, y: null });++ useEffect(() => {+ const handler = (e: MouseEvent) => {+ if (!ref.current) return;++ const boundingRect = ref.current.getBoundingClientRect();+ setPosition({+ x: (e.clientX - boundingRect.left) / boundingRect.width,+ y: (e.clientY - boundingRect.top) / boundingRect.height,+ });+ };++ window.addEventListener("mousemove", handler);+ return () => window.removeEventListener("mousemove", handler);+ }, []);++ return position;+}diff --git a/apps/web/app/[domain]/layout.tsx b/apps/web/app/[domain]/layout.tsxindex ea2a062c9e..c67a8ca8b7 100644--- a/apps/web/app/[domain]/layout.tsx+++ b/apps/web/app/[domain]/layout.tsx@@ -12,7 +12,6 @@ export default function CustomDomainLayout({<Nav />{children}<Footer />- <NewBackground /></div>);}diff --git a/apps/web/app/[domain]/placeholder.tsx b/apps/web/app/[domain]/placeholder.tsxindex 69678df760..c33d9b59cf 100644--- a/apps/web/app/[domain]/placeholder.tsx+++ b/apps/web/app/[domain]/placeholder.tsx@@ -1,90 +1,92 @@"use client";-import { InlineSnippet } from "@dub/ui";-import { createHref, STAGGER_CHILD_VARIANTS } from "@dub/utils";-import Spline from "@splinetool/react-spline";-import { motion } from "framer-motion";+import { buttonVariants, Grid, Logo } from "@dub/ui";+import { cn, createHref } from "@dub/utils";+import Link from "next/link";import { useParams } from "next/navigation";-import { useState } from "react";-import { useDebounce } from "use-debounce";+import { BrowserGraphic } from "./browser-graphic";+import { BubbleIcon } from "./bubble-icon";++const HERO_GRADIENT = `radial-gradient(77% 116% at 37% 67%, #EEA5BA, rgba(238, 165, 186, 0) 50%),+ radial-gradient(56% 84% at 34% 56%, #3A8BFD, rgba(58, 139, 253, 0) 50%),+ radial-gradient(85% 127% at 100% 100%, #E4C795, rgba(228, 199, 149, 0) 50%),+ radial-gradient(82% 122% at 3% 29%, #855AFC, rgba(133, 90, 252, 0) 50%),+ radial-gradient(90% 136% at 52% 100%, #FD3A4E, rgba(253, 58, 78, 0) 50%),+ radial-gradient(102% 143% at 92% 7%, #72FE7D, rgba(114, 254, 125, 0) 50%)`;export default function PlaceholderContent() {const { domain } = useParams() as { domain: string };- const [loading, setLoading] = useState(true);- const onLoad = () => {- setLoading(false);- };- // workaround to avoid the blinking effect when Spline loads- const [opacity] = useDebounce(loading ? 0 : 1, 200);-- const [showText] = useDebounce(loading ? false : true, 800);return (- <motion.div- className="z-10 mb-20"- exit={{ opacity: 0, scale: 0.95 }}- transition={{ duration: 0.5, type: "spring" }}- >- <div- className={`${- loading ? "scale-[25%] blur-md" : "scale-100 blur-0"- } mt-[7vh] h-[50vh] w-screen object-cover transition-all duration-1000`}- >- <Spline- onLoad={onLoad}- style={{ opacity: opacity }}- scene="https://assets.dub.co/misc/scene.splinecode"+ <div>+ <div className="relative mx-auto mt-4 w-full max-w-screen-lg overflow-hidden rounded-2xl bg-neutral-50 p-6 text-center sm:p-20 sm:px-0">+ <Grid+ cellSize={80}+ patternOffset={[1, -52.5]}+ className="inset-[unset] left-1/2 top-0 w-[1200px] -translate-x-1/2 text-neutral-300 [mask-image:linear-gradient(transparent,black_70%)]"/>- </div>- <motion.div- variants={{- show: {- transition: {- staggerChildren: 0.3,- },- },- }}- initial="hidden"- animate={showText ? "show" : "hidden"}- className="mx-5 flex flex-col items-center space-y-10 text-center sm:mx-auto"- >- <motion.h1- className="font-display text-4xl font-bold text-gray-800 transition-colors sm:text-5xl"- variants={STAGGER_CHILD_VARIANTS}- >- Welcome to {process.env.NEXT_PUBLIC_APP_NAME}- </motion.h1>- <motion.p- className="max-w-xl text-gray-600 transition-colors sm:text-lg"- variants={STAGGER_CHILD_VARIANTS}+ <div className="absolute -inset-x-10 -bottom-[10%] h-[60%] opacity-40 blur-[100px] [transform:translate3d(0,0,0)]">+ <div+ className="size-full -scale-y-100 [mask-image:radial-gradient(closest-side,black_100%,transparent_100%)]"+ style={{ backgroundImage: HERO_GRADIENT }}+ />+ </div>+ <div className="relative mx-auto flex w-full max-w-xl flex-col items-center">+ <BubbleIcon icon={Logo} />+ <div className="mt-16 w-full">+ <BrowserGraphic domain={domain} />+ </div>+ <h1+ className={cn(+ "font-display mt-2 text-center text-4xl font-medium text-neutral-900 sm:text-5xl sm:leading-[1.15]",+ "animate-slide-up-fade motion-reduce:animate-fade-in [--offset:20px] [animation-duration:1s] [animation-fill-mode:both]",+ )}+ >+ Welcome to Dub+ </h1>+ <p+ className={cn(+ "mt-5 text-balance text-base text-neutral-700 sm:text-xl",+ "animate-slide-up-fade motion-reduce:animate-fade-in [--offset:10px] [animation-delay:200ms] [animation-duration:1s] [animation-fill-mode:both]",+ )}+ >+ This custom domain is powered by Dub.co – the link management+ platform designed for modern marketing teams.+ </p>+ </div>++ <div+ className={cn(+ "relative mx-auto mt-10 flex max-w-fit space-x-4",+ "animate-slide-up-fade motion-reduce:animate-fade-in [--offset:5px] [animation-delay:300ms] [animation-duration:1s] [animation-fill-mode:both]",+ )}>- <InlineSnippet>{domain}</InlineSnippet> is a custom domain on{" "}- <a- className="bg-gradient-to-r from-purple-400 to-pink-600 bg-clip-text font-semibold text-transparent decoration-rose-600 hover:underline"- href={createHref("/", domain, {+ <Link+ href="https://d.to/register"+ className={cn(+ buttonVariants({ variant: "primary" }),+ "flex h-10 items-center rounded-lg border px-5 text-base",+ )}+ >+ Try Dub today+ </Link>+ <Link+ href={createHref("/home", domain, {utm_source: "Custom Domain",utm_medium: "Welcome Page",utm_campaign: domain,- utm_content: "Dub.co",+ utm_content: "Learn more",})}+ className={cn(+ buttonVariants({ variant: "secondary" }),+ "flex h-10 items-center rounded-lg border px-5 text-base",+ )}>- {process.env.NEXT_PUBLIC_APP_NAME}- </a>{" "}- - the link management platform for modern marketing teams.- </motion.p>- <motion.a- variants={STAGGER_CHILD_VARIANTS}- href={createHref("/home", domain, {- utm_source: "Custom Domain",- utm_medium: "Welcome Page",- utm_campaign: domain,- utm_content: "Create Your Free Branded Link",- })}- className="rounded-full bg-gray-800 px-10 py-2 font-medium text-white transition-colors hover:bg-black"- >- Create Your Free Branded Link- </motion.a>- </motion.div>- </motion.div>+ Learn more+ </Link>+ </div>+ </div>+ <div className="h-32" />+ </div>);}