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.

WIP nav updates

Tim Wilson9bb485b7a1e2
diff --git a/packages/ui/src/content.ts b/packages/ui/src/content.ts
index 1b6923c836..41c6857449 100644
--- a/packages/ui/src/content.ts
+++ b/packages/ui/src/content.ts
@@ -1,8 +1,10 @@
+import { ElementType } from "react";
import {
Book2Fill,
BulletListFill,
ConnectedDotsFill,
CubeSettingsFill,
+ DiamondTurnRightFill,
FeatherFill,
Github,
Go,
@@ -12,6 +14,7 @@ import {
Hyperlink,
LinesY,
LinkedIn,
+ MicrophoneFill,
Php,
ProductHunt,
Python,
@@ -19,11 +22,25 @@ import {
Ruby,
Twitter,
Typescript,
+ UsersFill,
YouTube,
} from "./icons";
import { Elxo } from "./icons/elxo";
import { Logo } from "./logo";
+export type NavItemChild = {
+ title: string;
+ description?: string;
+ href: string;
+ icon: ElementType;
+ iconClassName?: string;
+};
+
+export type NavItemChildren = (
+ | NavItemChild
+ | { label: string; items: NavItemChild[] }
+)[];
+
export const FEATURES_LIST = [
{
title: "Dub Links",
@@ -111,6 +128,31 @@ export const SDKS = [
},
];
+export const SOLUTIONS: NavItemChildren = [
+ {
+ icon: DiamondTurnRightFill,
+ title: "Marketing Attribution",
+ description: "Easily track and measure marketing impact",
+ href: "/analytics",
+ },
+ {
+ icon: MicrophoneFill,
+ title: "Content Creators",
+ description: "Intelligent audience insights and link tracking",
+ href: "/solutions/creators",
+ },
+ {
+ icon: UsersFill,
+ title: "Content Creators",
+ description: "Intelligent audience insights and link tracking",
+ href: "/solutions/creators",
+ },
+ {
+ label: "SDKs",
+ items: SDKS,
+ },
+];
+
export const RESOURCES = [
{
icon: Book2Fill,
diff --git a/packages/ui/src/icons/nucleo/diamond-turn-right-fill.tsx b/packages/ui/src/icons/nucleo/diamond-turn-right-fill.tsx
new file mode 100644
index 0000000000..ad3cd499de
--- /dev/null
+++ b/packages/ui/src/icons/nucleo/diamond-turn-right-fill.tsx
@@ -0,0 +1,20 @@
+import { SVGProps } from "react";
+
+export function DiamondTurnRightFill(props: SVGProps<SVGSVGElement>) {
+ return (
+ <svg
+ height="18"
+ width="18"
+ viewBox="0 0 18 18"
+ xmlns="http://www.w3.org/2000/svg"
+ {...props}
+ >
+ <g fill="currentColor">
+ <path
+ d="M16.116,7.056L10.944,1.884c-1.038-1.039-2.851-1.039-3.889,0L1.884,7.056c-.52,.519-.806,1.21-.806,1.944s.286,1.425,.806,1.944l5.171,5.171c.519,.52,1.209,.806,1.944,.806s1.425-.286,1.944-.806l5.171-5.171c.52-.519,.806-1.209,.806-1.944s-.286-1.425-.806-1.944Zm-3.335,2.225l-2.25,2.25c-.146,.146-.338,.22-.53,.22s-.384-.073-.53-.22c-.293-.293-.293-.768,0-1.061l.97-.97h-1.689c-.689,0-1.25,.561-1.25,1.25v.5c0,.414-.336,.75-.75,.75s-.75-.336-.75-.75v-.5c0-1.517,1.233-2.75,2.75-2.75h1.689l-.97-.97c-.293-.293-.293-.768,0-1.061s.768-.293,1.061,0l2.25,2.25c.293,.293,.293,.768,0,1.061Z"
+ fill="currentColor"
+ />
+ </g>
+ </svg>
+ );
+}
diff --git a/packages/ui/src/icons/nucleo/index.ts b/packages/ui/src/icons/nucleo/index.ts
index fa7085fca7..b4328cb106 100644
--- a/packages/ui/src/icons/nucleo/index.ts
+++ b/packages/ui/src/icons/nucleo/index.ts
@@ -67,6 +67,7 @@ export * from "./cursor-rays";
export * from "./database-key";
export * from "./desktop";
export * from "./diamond-turn-right";
+export * from "./diamond-turn-right-fill";
export * from "./directions";
export * from "./discount";
export * from "./dots";
@@ -134,6 +135,7 @@ export * from "./map-position";
export * from "./marketing-target";
export * from "./menu3";
export * from "./message-smile";
+export * from "./microphone-fill";
export * from "./mobile-phone";
export * from "./money-bill";
export * from "./money-bill2";
@@ -188,6 +190,7 @@ export * from "./user-crown";
export * from "./user-delete";
export * from "./user-plus";
export * from "./users";
+export * from "./users-fill";
export * from "./users-settings";
export * from "./users2";
export * from "./users6";
diff --git a/packages/ui/src/icons/nucleo/microphone-fill.tsx b/packages/ui/src/icons/nucleo/microphone-fill.tsx
new file mode 100644
index 0000000000..ac77a5f445
--- /dev/null
+++ b/packages/ui/src/icons/nucleo/microphone-fill.tsx
@@ -0,0 +1,24 @@
+import { SVGProps } from "react";
+
+export function MicrophoneFill(props: SVGProps<SVGSVGElement>) {
+ return (
+ <svg
+ height="18"
+ width="18"
+ viewBox="0 0 18 18"
+ xmlns="http://www.w3.org/2000/svg"
+ {...props}
+ >
+ <g fill="currentColor">
+ <path
+ d="M9,12c2.206,0,4-1.794,4-4v-3c0-2.206-1.794-4-4-4s-4,1.794-4,4v3c0,2.206,1.794,4,4,4Z"
+ fill="currentColor"
+ />
+ <path
+ d="M15.25,7.25c-.414,0-.75,.336-.75,.75,0,3.033-2.467,5.5-5.5,5.5s-5.5-2.467-5.5-5.5c0-.414-.336-.75-.75-.75s-.75,.336-.75,.75c0,3.606,2.742,6.583,6.25,6.958v1.292c0,.414,.336,.75,.75,.75s.75-.336,.75-.75v-1.292c3.508-.376,6.25-3.352,6.25-6.958,0-.414-.336-.75-.75-.75Z"
+ fill="currentColor"
+ />
+ </g>
+ </svg>
+ );
+}
diff --git a/packages/ui/src/icons/nucleo/users-fill.tsx b/packages/ui/src/icons/nucleo/users-fill.tsx
new file mode 100644
index 0000000000..c24573b68f
--- /dev/null
+++ b/packages/ui/src/icons/nucleo/users-fill.tsx
@@ -0,0 +1,26 @@
+import { SVGProps } from "react";
+
+export function UsersFill(props: SVGProps<SVGSVGElement>) {
+ return (
+ <svg
+ height="18"
+ width="18"
+ viewBox="0 0 18 18"
+ xmlns="http://www.w3.org/2000/svg"
+ {...props}
+ >
+ <g fill="currentColor">
+ <circle cx="5.75" cy="6.25" fill="currentColor" r="2.75" />
+ <circle cx="12" cy="3.75" fill="currentColor" r="2.75" />
+ <path
+ d="M17.196,11.098c-.811-2.152-2.899-3.598-5.196-3.598-1.417,0-2.752,.553-3.759,1.48,1.854,.709,3.385,2.169,4.109,4.089,.112,.296,.162,.603,.182,.91,1.211-.05,2.409-.26,3.565-.646,.456-.152,.834-.487,1.041-.919,.2-.42,.221-.888,.059-1.316Z"
+ fill="currentColor"
+ />
+ <path
+ d="M10.946,13.598c-.811-2.152-2.899-3.598-5.196-3.598S1.365,11.446,.554,13.598c-.162,.429-.141,.896,.059,1.316,.206,.432,.585,.767,1.041,.919,1.325,.442,2.704,.667,4.096,.667s2.771-.225,4.096-.667c.456-.152,.834-.487,1.041-.919,.2-.42,.221-.888,.059-1.316Z"
+ fill="currentColor"
+ />
+ </g>
+ </svg>
+ );
+}
diff --git a/packages/ui/src/nav/content/company-content.tsx b/packages/ui/src/nav/content/company-content.tsx
index 296ac24f48..510615ea76 100644
--- a/packages/ui/src/nav/content/company-content.tsx
+++ b/packages/ui/src/nav/content/company-content.tsx
@@ -9,7 +9,7 @@ import {
export function CompanyContent({ domain }: { domain: string }) {
return (
- <div className="grid w-[540px] grid-cols-[minmax(0,1fr),minmax(0,0.75fr)] divide-x divide-neutral-200">
+ <div className="grid w-[540px] grid-cols-[minmax(0,1fr),minmax(0,0.75fr)] divide-x divide-neutral-200 dark:divide-white/20">
<div className="flex flex-col gap-4 p-4">
{COMPANY.map(({ title, description, icon, href }) => (
<LargeLinkCard
diff --git a/packages/ui/src/nav/content/product-content.tsx b/packages/ui/src/nav/content/product-content.tsx
index eabade167c..531898e584 100644
--- a/packages/ui/src/nav/content/product-content.tsx
+++ b/packages/ui/src/nav/content/product-content.tsx
@@ -29,7 +29,7 @@ const largeLinks = [
export function ProductContent({ domain }: { domain: string }) {
return (
- <div className="grid w-[1020px] grid-cols-[minmax(0,1fr),0.4fr] divide-x divide-neutral-200">
+ <div className="grid w-[1020px] grid-cols-[minmax(0,1fr),0.4fr] divide-x divide-neutral-200 dark:divide-white/20">
<div className="grid grid-cols-2 gap-4 p-4">
<NavigationMenuLink asChild>
<Link
diff --git a/packages/ui/src/nav/content/resources-content.tsx b/packages/ui/src/nav/content/resources-content.tsx
index 1635bded5a..65659c4235 100644
--- a/packages/ui/src/nav/content/resources-content.tsx
+++ b/packages/ui/src/nav/content/resources-content.tsx
@@ -27,7 +27,7 @@ const mainLinks = [
export function ResourcesContent({ domain }: { domain: string }) {
return (
- <div className="grid w-[1020px] grid-cols-[minmax(0,1fr),0.4fr] divide-x divide-neutral-200">
+ <div className="grid w-[1020px] grid-cols-[minmax(0,1fr),0.4fr] divide-x divide-neutral-200 dark:divide-white/20">
<div className="grid grid-cols-2 gap-4 p-4">
{mainLinks.map(({ title, description, thumbnail, href }) => (
<NavigationMenuLink asChild>
diff --git a/packages/ui/src/nav/content/solutions-content.tsx b/packages/ui/src/nav/content/solutions-content.tsx
index d93f597246..f6738f6407 100644
--- a/packages/ui/src/nav/content/solutions-content.tsx
+++ b/packages/ui/src/nav/content/solutions-content.tsx
@@ -1,43 +1,115 @@
import { cn, createHref } from "@dub/utils";
-import { Code, OfficeBuilding } from "../../icons";
+import { Link as NavigationMenuLink } from "@radix-ui/react-navigation-menu";
+import Link from "next/link";
+import { SDKS } from "../../content";
+import { Grid } from "../../grid";
+import { DiamondTurnRightFill, MicrophoneFill, UsersFill } from "../../icons";
import {
- ContentIcon,
ContentLinkCard,
contentHeadingClassName,
+ getUtmParams,
} from "./shared";
-const PROFILES = [
+const mainLinks = [
{
- icon: Code,
- title: "Developers",
- description: "API for efficient link management",
- href: "/docs/introduction",
+ icon: DiamondTurnRightFill,
+ title: "Marketing Attribution",
+ description: "Easily track and measure marketing impact",
+ href: "/analytics",
},
{
- icon: OfficeBuilding,
- title: "Enterprise",
- description: "Scalable link management solutions",
- href: "/enterprise",
+ icon: MicrophoneFill,
+ title: "Content Creators",
+ description: "Intelligent audience insights and link tracking",
+ href: "/solutions/creators",
+ },
+ {
+ icon: UsersFill,
+ title: "Affiliate Management",
+ description: "Manage affiliates and automate payouts",
+ href: "/partners",
},
];
export function SolutionsContent({ domain }: { domain: string }) {
return (
- <div className="grid w-[32rem] grid-cols-[5fr_3.5fr]">
- <div className="p-5">
- <p className={cn(contentHeadingClassName, "mb-2")}>Profiles</p>
- <div className="-mx-2 flex flex-col gap-0.5">
- {PROFILES.map(({ icon, title, description, href }) => (
+ <div className="grid w-[1020px] grid-cols-[minmax(0,1fr),0.4fr] divide-x divide-neutral-200 dark:divide-white/20">
+ <div className="flex h-full flex-col p-4">
+ <p className={cn(contentHeadingClassName, "mb-4 ml-2")}>By use case</p>
+ <div className="grid grow grid-cols-3 gap-4">
+ {mainLinks.map(({ icon: Icon, title, description, href }) => (
+ <NavigationMenuLink asChild>
+ <Link
+ key={title}
+ href={createHref(
+ href,
+ domain,
+ getUtmParams({ domain, utm_content: title }),
+ )}
+ className={cn(
+ "group relative flex flex-col justify-between overflow-hidden rounded-xl border border-neutral-100 bg-neutral-50 px-5 py-4 transition-colors duration-75 hover:bg-neutral-100/80",
+ "dark:border-white/20 dark:bg-neutral-900",
+ )}
+ >
+ <div className="absolute inset-0 isolate bg-neutral-50 opacity-0 transition-opacity duration-150 [transform:translateZ(0)] group-hover:opacity-100 dark:bg-neutral-900">
+ <div className="absolute -inset-[25%] -skew-y-12 [mask-image:linear-gradient(225deg,black,transparent_50%)]">
+ <Grid
+ cellSize={46}
+ patternOffset={[0, -14]}
+ className="translate-y-4 text-neutral-400 transition-transform duration-150 ease-out group-hover:translate-y-0 dark:text-white/30"
+ />
+ </div>
+ <div
+ className={cn(
+ "absolute -inset-[10%] opacity-5 blur-lg dark:hidden",
+ "bg-[conic-gradient(#F35066_0deg,#F35066_117deg,#9071F9_180deg,#5182FC_240deg,#F35066_360deg)]",
+ )}
+ />
+ <div
+ className={cn(
+ "absolute -inset-[10%] opacity-80 mix-blend-overlay blur-lg dark:brightness-150",
+ "bg-[conic-gradient(#F35066_0deg,#F35066_117deg,#9071F9_180deg,#5182FC_240deg,#F35066_360deg)]",
+ )}
+ />
+ </div>
+ <Icon className="relative size-5 text-neutral-700 dark:text-white/60" />
+ <div className="relative">
+ <span className="text-sm font-medium text-neutral-900 dark:text-white">
+ {title}
+ </span>
+ <p className="mt-2 text-xs text-neutral-500 dark:text-white/60">
+ {description}
+ </p>
+ </div>
+ </Link>
+ </NavigationMenuLink>
+ ))}
+ </div>
+ </div>
+ <div className="px-6 py-4">
+ <p className={cn(contentHeadingClassName, "mb-2")}>SDKs</p>
+ <div className="flex flex-col gap-0.5">
+ {SDKS.map(({ icon: Icon, iconClassName, title, href }) => (
<ContentLinkCard
- href={createHref(href, domain, {
- utm_source: "Custom Domain",
- utm_medium: "Navbar",
- utm_campaign: domain,
- utm_content: title,
- })}
- icon={<ContentIcon icon={icon} />}
+ key={href}
+ className="-mx-2"
+ href={createHref(
+ href,
+ domain,
+ getUtmParams({ domain, utm_content: title }),
+ )}
+ icon={
+ <div className="shrink-0 rounded-[10px] border border-neutral-200 bg-white/50 p-1 dark:border-white/20 dark:bg-white/10">
+ <Icon
+ className={cn(
+ "size-5 text-neutral-600 transition-colors dark:text-white/60",
+ iconClassName,
+ )}
+ />
+ </div>
+ }
title={title}
- description={description}
+ showArrow
/>
))}
</div>
diff --git a/packages/ui/src/nav/nav-mobile.tsx b/packages/ui/src/nav/nav-mobile.tsx
index bc916b0110..90d545a854 100644
--- a/packages/ui/src/nav/nav-mobile.tsx
+++ b/packages/ui/src/nav/nav-mobile.tsx
@@ -4,10 +4,11 @@ import { APP_DOMAIN, cn, createHref, fetcher } from "@dub/utils";
import { ChevronDown, Menu, X } from "lucide-react";
import Link from "next/link";
import { useParams } from "next/navigation";
-import { ComponentProps, ElementType, useEffect, useState } from "react";
+import { ComponentProps, useEffect, useState } from "react";
import useSWR from "swr";
import { AnimatedSizeContainer } from "../animated-size-container";
import { ButtonProps, buttonVariants } from "../button";
+import { NavItemChild, NavItemChildren } from "../content";
import { navItems, type NavTheme } from "./nav";
export function NavMobile({
@@ -134,13 +135,7 @@ const MobileNavItem = ({
}: {
name: string;
href?: string;
- childItems?: {
- title: string;
- description: string;
- href: string;
- icon: ElementType;
- iconClassName?: string;
- }[];
+ childItems?: NavItemChildren;
setOpen: (open: boolean) => void;
}) => {
const { domain = "dub.co" } = useParams() as { domain: string };
@@ -163,32 +158,26 @@ const MobileNavItem = ({
/>
</button>
{expanded && (
- <div className="grid gap-4 overflow-hidden py-4">
- {childItems.map(({ title, href, icon: Icon, description }) => (
- <Link
- key={href}
- href={createHref(href, domain, {
- utm_source: "Custom Domain",
- utm_medium: "Navbar",
- utm_campaign: domain,
- utm_content: title,
- })}
- onClick={() => setOpen(false)}
- className="flex w-full gap-3"
- >
- <div className="flex size-10 items-center justify-center rounded-lg border border-neutral-200 bg-gradient-to-t from-neutral-100">
- <Icon className="size-5 text-neutral-700" />
- </div>
- <div>
- <div className="flex items-center gap-2">
- <h2 className="text-sm font-medium text-neutral-900">
- {title}
- </h2>
- </div>
- <p className="text-sm text-neutral-500">{description}</p>
+ <div className="grid grid-cols-1 gap-4 overflow-hidden py-4">
+ {childItems.map((item, idx) =>
+ "items" in item ? (
+ <div key={idx} className="grid grid-cols-1 gap-3">
+ <span className="text-xs font-medium uppercase text-neutral-500 dark:text-white/50">
+ {item.label}
+ </span>
+ {item.items.map((childItem, childIdx) => (
+ <ChildItem
+ key={childIdx}
+ item={childItem}
+ setOpen={setOpen}
+ size="small"
+ />
+ ))}
</div>
- </Link>
- ))}
+ ) : (
+ <ChildItem key={idx} item={item} setOpen={setOpen} />
+ ),
+ )}
</div>
)}
</AnimatedSizeContainer>
@@ -218,6 +207,53 @@ const MobileNavItem = ({
);
};
+const ChildItem = ({
+ item: { title, description, href, icon: Icon },
+ setOpen,
+ size = "normal",
+}: {
+ item: NavItemChild;
+ setOpen: (open: boolean) => void;
+ size?: "normal" | "small";
+}) => {
+ const { domain = "dub.co" } = useParams() as { domain: string };
+
+ return (
+ <Link
+ href={createHref(href, domain, {
+ utm_source: "Custom Domain",
+ utm_medium: "Navbar",
+ utm_campaign: domain,
+ utm_content: title,
+ })}
+ onClick={() => setOpen(false)}
+ className="flex w-full items-center gap-3"
+ >
+ <div
+ className={cn(
+ "flex size-10 items-center justify-center rounded-lg border border-neutral-200 bg-gradient-to-t from-neutral-100",
+ size === "small" && "size-8",
+ )}
+ >
+ <Icon
+ className={cn(
+ "size-5 text-neutral-700 grayscale",
+ size === "small" && "size-4",
+ )}
+ />
+ </div>
+ <div>
+ <div className="flex items-center gap-2">
+ <h2 className="text-sm font-medium text-neutral-900">{title}</h2>
+ </div>
+ {description && (
+ <p className="text-sm text-neutral-500">{description}</p>
+ )}
+ </div>
+ </Link>
+ );
+};
+
export function AuthButton({
variant,
className,
diff --git a/packages/ui/src/nav/nav.tsx b/packages/ui/src/nav/nav.tsx
index 40f454246c..22df556169 100644
--- a/packages/ui/src/nav/nav.tsx
+++ b/packages/ui/src/nav/nav.tsx
@@ -8,13 +8,14 @@ import { useParams, usePathname } from "next/navigation";
import { PropsWithChildren, SVGProps, createContext, useId } from "react";
import useSWR from "swr";
import { buttonVariants } from "../button";
-import { COMPANY, FEATURES_LIST, RESOURCES } from "../content";
+import { COMPANY, FEATURES_LIST, RESOURCES, SOLUTIONS } from "../content";
import { useScroll } from "../hooks";
import { MaxWidthWrapper } from "../max-width-wrapper";
import { NavWordmark } from "../nav-wordmark";
import { CompanyContent } from "./content/company-content";
import { ProductContent } from "./content/product-content";
import { ResourcesContent } from "./content/resources-content";
+import { SolutionsContent } from "./content/solutions-content";
export type NavTheme = "light" | "dark";
@@ -29,11 +30,17 @@ export const navItems = [
childItems: FEATURES_LIST,
segments: ["/home", "/analytics", "/features", "/compare"],
},
+ {
+ name: "Solutions",
+ content: SolutionsContent,
+ childItems: SOLUTIONS,
+ segments: ["/solutions"],
+ },
{
name: "Resources",
content: ResourcesContent,
childItems: RESOURCES,
- segments: ["/solutions", "/docs", "/help", "/brand"],
+ segments: ["/docs", "/help", "/brand"],
},
{
name: "Company",