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.

Performance improvement, tweaks, some content

Tim Wilson1691bd2a5602
diff --git a/apps/web/app/[domain]/bubble-icon.tsx b/apps/web/app/[domain]/bubble-icon.tsx
index 63f158d766..df5562a6f5 100644
--- a/apps/web/app/[domain]/bubble-icon.tsx
+++ b/apps/web/app/[domain]/bubble-icon.tsx
@@ -1,34 +1,49 @@
"use client";
import { Icon } from "@dub/ui";
-import { CSSProperties, RefObject, useEffect, useRef, useState } from "react";
+import { useEffect, useRef } from "react";
export function BubbleIcon({ icon: Icon }: { icon: Icon }) {
const ref = useRef<HTMLDivElement>(null);
- const position = useRelativeMousePosition(ref);
+
+ // Pass relative mouse position to the element
+ useEffect(() => {
+ const handler = (e: MouseEvent) => {
+ if (!ref.current) return;
+
+ const boundingRect = ref.current.getBoundingClientRect();
+ ref.current.style.setProperty(
+ "--mx",
+ ((e.clientX - boundingRect.left) / boundingRect.width).toString(),
+ );
+ ref.current.style.setProperty(
+ "--my",
+ ((e.clientY - boundingRect.top) / boundingRect.height).toString(),
+ );
+ };
+
+ window.addEventListener("mousemove", handler);
+ return () => window.removeEventListener("mousemove", handler);
+ }, [ref]);
return (
<div
ref={ref}
className="rounded-full [perspective:500px]"
- style={
- {
- "--mx": position.x ?? 0.5,
- "--my": position.y ?? 0.5,
- filter: `
+ style={{
+ 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))`,
+ transform: `rotateY(clamp(-20deg, calc(var(--mx, 0.5) * 4deg), 20deg)) rotateX(clamp(-20deg, calc(var(--my, 0.5) * -4deg), 20deg))`,
}}
>
<div className="rounded-full bg-gradient-to-b from-white to-neutral-100 p-8">
@@ -51,27 +66,3 @@ export function BubbleIcon({ icon: Icon }: { icon: Icon }) {
</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]/placeholder.tsx b/apps/web/app/[domain]/placeholder.tsx
index c33d9b59cf..6ddc4cc7b7 100644
--- a/apps/web/app/[domain]/placeholder.tsx
+++ b/apps/web/app/[domain]/placeholder.tsx
@@ -22,10 +22,10 @@ export default function PlaceholderContent() {
<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]}
+ patternOffset={[1, -58]}
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 className="absolute -inset-x-10 -bottom-[10%] h-[60%] opacity-40 blur-[100px] [transform:translate3d(0,0,0)]">
+ <div className="absolute -inset-x-10 bottom-0 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 }}
@@ -86,7 +86,21 @@ export default function PlaceholderContent() {
</Link>
</div>
</div>
- <div className="h-32" />
+ <div className="mt-20">
+ <div className="mx-auto w-full max-w-xl px-4 text-center">
+ <div className="mx-auto flex h-7 w-fit items-center rounded-full border border-neutral-200 bg-white px-4 text-xs text-neutral-800">
+ What is Dub?
+ </div>
+ <h2 className="font-display mt-2 text-balance text-3xl font-medium text-neutral-900">
+ Powerful features for modern marketing teams
+ </h2>
+ <p className="mt-3 text-pretty text-lg text-neutral-500">
+ Dub is more than just a link shortener. We've built a suite of
+ powerful features that gives you marketing superpowers.
+ </p>
+ </div>
+ </div>
+ <div className="mt-14"></div>
</div>
);
}