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.

Add Product and Solutions content

Tim Wilson803f7fe67be3
diff --git a/packages/ui/src/content.ts b/packages/ui/src/content.ts
index 7041016a8c..60b248e9c8 100644
--- a/packages/ui/src/content.ts
+++ b/packages/ui/src/content.ts
@@ -1,8 +1,16 @@
import {
ChartLine,
+ Code,
+ Go,
Hyperlink,
+ OfficeBuilding,
Paintbrush,
+ Prisma,
+ Python,
QRCode,
+ Raycast,
+ Tinybird,
+ Typescript,
Users,
WindowSettings,
} from "./icons";
@@ -45,3 +53,66 @@ export const FEATURES_LIST = [
slug: "docs/api-reference/introduction",
},
];
+
+export const CUSTOMER_STORIES = [
+ {
+ icon: Raycast,
+ iconClassName: "group-hover:text-[#FF6363]",
+ title: "Raycast",
+ description:
+ "How Raycast added link-sharing features to Ray.so with Dub.co's link infrastructure",
+ href: "/customers/raycast",
+ },
+ {
+ icon: Tinybird,
+ iconClassName: "group-hover:text-[#268472]",
+ title: "Tinybird",
+ description:
+ "How Tinybird uses Dub.co to enhance their digital marketing strategies",
+ href: "/customers/tinybird",
+ },
+ {
+ icon: Prisma,
+ iconClassName: "group-hover:text-[#4C51BF]",
+ title: "Prisma",
+ description: "How Prisma uses Dub.co to improve insights for pris.ly links",
+ href: "/customers/prisma",
+ },
+];
+
+export const PROFILES = [
+ {
+ icon: Code,
+ title: "Developers",
+ description: "API for efficient link management",
+ href: "/docs/introduction",
+ },
+ {
+ icon: OfficeBuilding,
+ title: "Enterprise",
+ description: "Scalable link management solutions",
+ href: "/enterprise",
+ },
+];
+
+export const SDKS = [
+ {
+ icon: Typescript,
+ iconClassName: "py-0.5 group-hover:text-[#3178C6]",
+ name: "Typescript",
+ href: "/solutions/typescript",
+ },
+ {
+ icon: Python,
+ iconClassName:
+ "py-0.5 [&_.snake]:transition-colors group-hover:[&_.snake1]:text-[#3776ab] group-hover:[&_.snake2]:text-[#ffd343]",
+ name: "Python",
+ href: "/solutions/python",
+ },
+ {
+ icon: Go,
+ iconClassName: "group-hover:text-[#00ACD7]",
+ name: "Go",
+ href: "/solutions/go",
+ },
+];
diff --git a/packages/ui/src/icons/go.tsx b/packages/ui/src/icons/go.tsx
new file mode 100644
index 0000000000..c06c6bbbb6
--- /dev/null
+++ b/packages/ui/src/icons/go.tsx
@@ -0,0 +1,21 @@
+import { SVGProps } from "react";
+
+export function Go(props: SVGProps<SVGSVGElement>) {
+ return (
+ <svg
+ xmlns="http://www.w3.org/2000/svg"
+ viewBox="0 0 207 78"
+ fill="none"
+ {...props}
+ >
+ <path
+ fill="currentColor"
+ d="M16.2 24.1c-.4 0-.5-.2-.3-.5l2.1-2.7c.2-.3.7-.5 1.1-.5h35.7c.4 0 .5.3.3.6l-1.7 2.6c-.2.3-.7.6-1 .6l-36.2-.1ZM1.1 33.3c-.4 0-.5-.2-.3-.5l2.1-2.7c.2-.3.7-.5 1.1-.5h45.6c.4 0 .6.3.5.6l-.8 2.4c-.1.4-.5.6-.9.6l-47.3.1ZM25.3 42.5c-.4 0-.5-.3-.3-.6l1.4-2.5c.2-.3.6-.6 1-.6h20c.4 0 .6.3.6.7l-.2 2.4c0 .4-.4.7-.7.7l-21.8-.1ZM129.1 22.3c-6.3 1.6-10.6 2.8-16.8 4.4-1.5.4-1.6.5-2.9-1-1.5-1.7-2.6-2.8-4.7-3.8-6.3-3.1-12.4-2.2-18.1 1.5-6.8 4.4-10.3 10.9-10.2 19 .1 8 5.6 14.6 13.5 15.7 6.8.9 12.5-1.5 17-6.6.9-1.1 1.7-2.3 2.7-3.7H90.3c-2.1 0-2.6-1.3-1.9-3 1.3-3.1 3.7-8.3 5.1-10.9.3-.6 1-1.6 2.5-1.6h36.4c-.2 2.7-.2 5.4-.6 8.1-1.1 7.2-3.8 13.8-8.2 19.6-7.2 9.5-16.6 15.4-28.5 17-9.8 1.3-18.9-.6-26.9-6.6-7.4-5.6-11.6-13-12.7-22.2-1.3-10.9 1.9-20.7 8.5-29.3C71.1 9.6 80.5 3.7 92 1.6c9.4-1.7 18.4-.6 26.5 4.9 5.3 3.5 9.1 8.3 11.6 14.1.6.9.2 1.4-1 1.7Z"
+ />
+ <path
+ fill="currentColor"
+ d="M162.2 77.6c-9.1-.2-17.4-2.8-24.4-8.8-5.9-5.1-9.6-11.6-10.8-19.3-1.8-11.3 1.3-21.3 8.1-30.2 7.3-9.6 16.1-14.6 28-16.7 10.2-1.8 19.8-.8 28.5 5.1 7.9 5.4 12.8 12.7 14.1 22.3 1.7 13.5-2.2 24.5-11.5 33.9-6.6 6.7-14.7 10.9-24 12.8-2.7.5-5.4.6-8 .9ZM186 37.2c-.1-1.3-.1-2.3-.3-3.3-1.8-9.9-10.9-15.5-20.4-13.3-9.3 2.1-15.3 8-17.5 17.4-1.8 7.8 2 15.7 9.2 18.9 5.5 2.4 11 2.1 16.3-.6 7.9-4.1 12.2-10.5 12.7-19.1Z"
+ />
+ </svg>
+ );
+}
diff --git a/packages/ui/src/icons/index.tsx b/packages/ui/src/icons/index.tsx
index 20514c75bf..8c74798075 100644
--- a/packages/ui/src/icons/index.tsx
+++ b/packages/ui/src/icons/index.tsx
@@ -15,10 +15,16 @@ export { default as LoadingSpinner } from "./loading-spinner";
// brand logos
export { default as Facebook } from "./facebook";
export { default as Github } from "./github";
+export * from "./go";
export { default as Google } from "./google";
export { default as LinkedIn } from "./linkedin";
+export * from "./prisma";
export { default as ProductHunt } from "./product-hunt";
+export * from "./python";
+export * from "./raycast";
+export * from "./tinybird";
export { default as Twitter } from "./twitter";
+export * from "./typescript";
export { default as Unsplash } from "./unsplash";
export { default as YouTube } from "./youtube";
diff --git a/packages/ui/src/icons/nucleo/code.tsx b/packages/ui/src/icons/nucleo/code.tsx
new file mode 100644
index 0000000000..2839873bc4
--- /dev/null
+++ b/packages/ui/src/icons/nucleo/code.tsx
@@ -0,0 +1,37 @@
+import { SVGProps } from "react";
+
+export function Code(props: SVGProps<SVGSVGElement>) {
+ return (
+ <svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg" {...props}>
+ <g fill="currentColor">
+ <polyline
+ fill="none"
+ points="5.25 12.5 1.75 9 5.25 5.5"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="1.5"
+ />
+ <polyline
+ fill="none"
+ points="12.75 12.5 16.25 9 12.75 5.5"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="1.5"
+ />
+ <line
+ fill="none"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="1.5"
+ x1="7.5"
+ x2="10.5"
+ y1="15.25"
+ y2="2.75"
+ />
+ </g>
+ </svg>
+ );
+}
diff --git a/packages/ui/src/icons/nucleo/index.ts b/packages/ui/src/icons/nucleo/index.ts
index 7890fcd58b..5b935c687f 100644
--- a/packages/ui/src/icons/nucleo/index.ts
+++ b/packages/ui/src/icons/nucleo/index.ts
@@ -1,4 +1,5 @@
export * from "./chart-line";
+export * from "./code";
export * from "./crosshairs";
export * from "./cube";
export * from "./cursor-rays";
diff --git a/packages/ui/src/icons/nucleo/users.tsx b/packages/ui/src/icons/nucleo/users.tsx
index 217dcea6a6..57cde6e871 100644
--- a/packages/ui/src/icons/nucleo/users.tsx
+++ b/packages/ui/src/icons/nucleo/users.tsx
@@ -7,6 +7,7 @@ export function Users(props: SVGProps<SVGSVGElement>) {
width="18"
viewBox="0 0 18 18"
xmlns="http://www.w3.org/2000/svg"
+ {...props}
>
<g fill="currentColor">
<circle
diff --git a/packages/ui/src/icons/prisma.tsx b/packages/ui/src/icons/prisma.tsx
new file mode 100644
index 0000000000..1496d6d6ae
--- /dev/null
+++ b/packages/ui/src/icons/prisma.tsx
@@ -0,0 +1,19 @@
+import { SVGProps } from "react";
+
+export function Prisma(props: SVGProps<SVGSVGElement>) {
+ return (
+ <svg
+ xmlns="http://www.w3.org/2000/svg"
+ viewBox="0 0 159 194"
+ fill="none"
+ {...props}
+ >
+ <path
+ fill="currentColor"
+ fillRule="evenodd"
+ d="M2.397 122.867a9.632 9.632 0 0 0 .077 10.192l35.622 56.193a9.633 9.633 0 0 0 10.905 4.069l102.797-30.839c5.61-1.683 8.432-7.941 5.98-13.26L91.695 5.872c-3.222-6.99-12.938-7.564-16.961-1.001L2.397 122.867ZM89.94 38.644c-1.404-3.25-6.16-2.75-6.857.722L57.64 166.044c-.537 2.671 1.964 4.952 4.575 4.173l71.025-21.202a3.61 3.61 0 0 0 2.282-4.894L89.94 38.644Z"
+ clipRule="evenodd"
+ />
+ </svg>
+ );
+}
diff --git a/packages/ui/src/icons/python.tsx b/packages/ui/src/icons/python.tsx
new file mode 100644
index 0000000000..62afa2dd02
--- /dev/null
+++ b/packages/ui/src/icons/python.tsx
@@ -0,0 +1,23 @@
+import { SVGProps } from "react";
+
+export function Python(props: SVGProps<SVGSVGElement>) {
+ return (
+ <svg
+ xmlns="http://www.w3.org/2000/svg"
+ fill="none"
+ viewBox="0 0 112 113"
+ {...props}
+ >
+ <path
+ className="snake snake1"
+ fill="currentColor"
+ d="M54.919 0c-4.584.022-8.961.413-12.813 1.095C30.76 3.099 28.7 7.295 28.7 15.032v10.219h26.813v3.406H18.637c-7.792 0-14.615 4.684-16.75 13.594-2.461 10.213-2.57 16.586 0 27.25 1.906 7.938 6.458 13.594 14.25 13.594h9.22v-12.25c0-8.85 7.656-16.657 16.75-16.657h26.78c7.456 0 13.407-6.138 13.407-13.625v-25.53c0-7.267-6.13-12.726-13.406-13.938C64.28.328 59.502-.02 54.918 0Zm-14.5 8.22c2.77 0 5.031 2.298 5.031 5.125 0 2.816-2.262 5.093-5.031 5.093-2.78 0-5.031-2.277-5.031-5.093 0-2.827 2.251-5.125 5.03-5.125Z"
+ />
+ <path
+ className="snake snake2"
+ fill="currentColor"
+ d="M85.638 28.657v11.906c0 9.231-7.826 17-16.75 17H42.106c-7.336 0-13.406 6.279-13.406 13.625V96.72c0 7.266 6.319 11.54 13.406 13.625 8.488 2.495 16.627 2.946 26.782 0 6.75-1.955 13.406-5.888 13.406-13.625V86.5H55.513v-3.405H95.7c7.793 0 10.696-5.436 13.406-13.594 2.8-8.399 2.681-16.476 0-27.25-1.925-7.758-5.604-13.594-13.406-13.594H85.638ZM70.575 93.313c2.78 0 5.031 2.278 5.031 5.094 0 2.827-2.251 5.125-5.03 5.125-2.77 0-5.032-2.298-5.032-5.125 0-2.816 2.261-5.094 5.031-5.094Z"
+ />
+ </svg>
+ );
+}
diff --git a/packages/ui/src/icons/raycast.tsx b/packages/ui/src/icons/raycast.tsx
new file mode 100644
index 0000000000..3a28989d5f
--- /dev/null
+++ b/packages/ui/src/icons/raycast.tsx
@@ -0,0 +1,19 @@
+import { SVGProps } from "react";
+
+export function Raycast(props: SVGProps<SVGSVGElement>) {
+ return (
+ <svg
+ xmlns="http://www.w3.org/2000/svg"
+ viewBox="0 0 176 177"
+ fill="none"
+ {...props}
+ >
+ <path
+ fill="currentColor"
+ fillRule="evenodd"
+ d="m175.88 88.5-9.17 9.18-34.79-34.79V44.54l43.96 43.96ZM88 .59l-9.17 9.18 34.78 34.78h18.35L88 .59ZM68.32 20.28l-9.18 9.17 15.1 15.1h18.35L68.32 20.28Zm63.64 63.64v18.35l15.1 15.1 9.18-9.17-24.28-24.28ZM126.67 118l5.25-5.26H63.69v-68.2l-5.26 5.26-9.84-9.8-9.17 9.18 9.84 9.84L44 64.23v10.51l-15.1-15.1-9.18 9.18L44 93.09v21L9.22 79.33 0 88.5l88 87.92 9.18-9.17-34.79-34.79h21l24.27 24.27 9.18-9.18-15.1-15.1h10.51l5.26-5.26 9.84 9.84 9.17-9.18-9.85-9.85Z"
+ clipRule="evenodd"
+ />
+ </svg>
+ );
+}
diff --git a/packages/ui/src/icons/tinybird.tsx b/packages/ui/src/icons/tinybird.tsx
new file mode 100644
index 0000000000..0e367e88f1
--- /dev/null
+++ b/packages/ui/src/icons/tinybird.tsx
@@ -0,0 +1,22 @@
+import { SVGProps } from "react";
+
+export function Tinybird(props: SVGProps<SVGSVGElement>) {
+ return (
+ <svg
+ xmlns="http://www.w3.org/2000/svg"
+ viewBox="0 0 25 26"
+ fill="none"
+ {...props}
+ >
+ <path
+ fill="currentColor"
+ d="M25 2.64 17.195.5 14.45 6.635 25 2.64Zm-7.465 15.13-7.145-2.555L6.195 25.5l11.34-7.73Z"
+ opacity={0.6}
+ />
+ <path
+ fill="currentColor"
+ d="m0 11.495 17.535 6.275L20.41 4.36 0 11.495Z"
+ />
+ </svg>
+ );
+}
diff --git a/packages/ui/src/icons/typescript.tsx b/packages/ui/src/icons/typescript.tsx
new file mode 100644
index 0000000000..ac85527827
--- /dev/null
+++ b/packages/ui/src/icons/typescript.tsx
@@ -0,0 +1,27 @@
+import { SVGProps } from "react";
+
+export function Typescript(props: SVGProps<SVGSVGElement>) {
+ return (
+ <svg
+ xmlns="http://www.w3.org/2000/svg"
+ viewBox="0 0 128 128"
+ fill="none"
+ {...props}
+ >
+ <svg
+ xmlns="http://www.w3.org/2000/svg"
+ width={128}
+ height={128}
+ fill="none"
+ {...props}
+ >
+ <path
+ fill="currentColor"
+ fillRule="evenodd"
+ d="M6 0h116a6 6 0 0 1 6 6v116a6 6 0 0 1-6 6H6a6 6 0 0 1-6-6V6a6 6 0 0 1 6-6Zm68.262 113.494V99.468c2.535 2.133 5.288 3.733 8.26 4.799 2.97 1.067 5.971 1.6 9.001 1.6 1.778 0 3.329-.161 4.654-.482 1.326-.321 2.433-.767 3.322-1.337.888-.57 1.551-1.242 1.988-2.016a5.04 5.04 0 0 0 .655-2.52c0-1.228-.349-2.323-1.049-3.287-.699-.965-1.653-1.856-2.862-2.674-1.209-.818-2.644-1.607-4.304-2.367-1.66-.76-3.452-1.534-5.375-2.323-4.895-2.045-8.543-4.544-10.947-7.495C75.202 78.415 74 74.85 74 70.672c0-3.273.656-6.085 1.966-8.438a16.732 16.732 0 0 1 5.354-5.807c2.257-1.52 4.872-2.637 7.844-3.353C92.135 52.358 95.28 52 98.603 52c3.263 0 6.154.197 8.674.592 2.52.394 4.843 1 6.97 1.819v13.105a21.071 21.071 0 0 0-3.43-1.929 27.158 27.158 0 0 0-3.824-1.38 29.09 29.09 0 0 0-3.911-.811 27.607 27.607 0 0 0-3.693-.263c-1.602 0-3.059.153-4.37.46-1.31.307-2.418.738-3.32 1.293-.904.555-1.603 1.22-2.098 1.994-.496.775-.743 1.644-.743 2.608 0 1.052.276 1.995.83 2.827.553.833 1.34 1.622 2.36 2.367 1.02.745 2.257 1.476 3.714 2.192a84.756 84.756 0 0 0 4.938 2.213c2.506 1.052 4.756 2.17 6.752 3.353 1.995 1.183 3.707 2.52 5.134 4.01a15.632 15.632 0 0 1 3.278 5.107c.757 1.914 1.136 4.142 1.136 6.684 0 3.506-.663 6.45-1.988 8.831a16.179 16.179 0 0 1-5.397 5.786c-2.273 1.476-4.916 2.535-7.932 3.178-3.015.643-6.198.964-9.548.964-3.438 0-6.708-.292-9.81-.877-3.103-.584-5.79-1.461-8.063-2.629ZM69 64.554H50.703V116H36.208V64.554H18V53h51v11.554Z"
+ clipRule="evenodd"
+ />
+ </svg>
+ </svg>
+ );
+}
diff --git a/packages/ui/src/nav/content/product-content.tsx b/packages/ui/src/nav/content/product-content.tsx
new file mode 100644
index 0000000000..000695d9d1
--- /dev/null
+++ b/packages/ui/src/nav/content/product-content.tsx
@@ -0,0 +1,87 @@
+import { COMPARE_PAGES, cn } from "@dub/utils";
+import va from "@vercel/analytics";
+import { ChevronRight } from "lucide-react";
+import Link from "next/link";
+import { CUSTOMER_STORIES, FEATURES_LIST } from "../../content";
+import { ContentProps, createHref } from "../shared";
+import {
+ ContentIcon,
+ ContentLinkCard,
+ contentHeadingClassName,
+} from "./shared";
+
+export function ProductContent({ domain }: ContentProps) {
+ return (
+ <div className="grid w-[40rem] grid-cols-2">
+ <div className="p-5">
+ <p className={cn(contentHeadingClassName, "mb-2")}>Features</p>
+ <div className="-mx-2 -mb-2 grid grid-cols-1 gap-0.5">
+ {FEATURES_LIST.map(({ slug, icon, title, shortTitle }) => (
+ <ContentLinkCard
+ key={slug}
+ href={createHref(`/${slug}`, domain)}
+ {...(domain !== "dub.co" && {
+ onClick: () => {
+ va.track("Referred from custom domain", {
+ domain,
+ medium: `navbar item (/${slug})`,
+ });
+ },
+ })}
+ icon={<ContentIcon icon={icon} />}
+ title={shortTitle}
+ description={title}
+ />
+ ))}
+ </div>
+ </div>
+ <div className="border-l border-gray-200 p-5">
+ <Link
+ href={createHref("/blog/category/customers", domain)}
+ className={cn(
+ contentHeadingClassName,
+ "group mb-2 flex items-center transition-colors hover:text-black",
+ )}
+ >
+ Customer Stories
+ <ChevronRight className="ml-0.5 h-2.5 w-2.5 transition-transform group-hover:translate-x-px" />
+ </Link>
+ <div className="grid grid-cols-1">
+ {CUSTOMER_STORIES.map(
+ ({ icon: Icon, iconClassName, title, description, href }) => (
+ <ContentLinkCard
+ key={href}
+ href={createHref(href, domain)}
+ className="-mx-2"
+ icon={
+ <Icon
+ className={cn(
+ "h-7 w-7 shrink-0 text-gray-600 transition-colors",
+ iconClassName,
+ )}
+ />
+ }
+ title={title}
+ description={description}
+ descriptionLines={2}
+ />
+ ),
+ )}
+ </div>
+
+ <p className={cn(contentHeadingClassName, "my-4")}>Compare</p>
+ <div className="flex flex-col gap-1.5">
+ {COMPARE_PAGES.map(({ name, slug }) => (
+ <Link
+ key={slug}
+ href={createHref(`/compare/${slug}`, domain)}
+ className="block text-xs text-gray-600 transition-colors hover:text-black"
+ >
+ Dub vs. {name}
+ </Link>
+ ))}
+ </div>
+ </div>
+ </div>
+ );
+}
diff --git a/packages/ui/src/nav/content/shared.tsx b/packages/ui/src/nav/content/shared.tsx
new file mode 100644
index 0000000000..3405c844ba
--- /dev/null
+++ b/packages/ui/src/nav/content/shared.tsx
@@ -0,0 +1,57 @@
+import { cn } from "@dub/utils";
+import Link from "next/link";
+import { ComponentProps, ReactNode, SVGProps } from "react";
+
+export const contentHeadingClassName = "text-xs uppercase text-gray-500";
+
+export const contentLinkCardClassName =
+ "group rounded-[8px] p-2 transition-colors hover:bg-gray-100 active:bg-gray-200 dark:hover:bg-white/[0.15] dark:active:bg-white/20";
+
+export function ContentLinkCard({
+ icon,
+ title,
+ description,
+ descriptionLines = 1,
+ className,
+ ...rest
+}: {
+ icon: ReactNode;
+ title: string;
+ description?: string;
+ descriptionLines?: 1 | 2;
+} & ComponentProps<typeof Link>) {
+ return (
+ <Link className={cn(contentLinkCardClassName, className)} {...rest}>
+ <div className="flex items-center gap-3">
+ {icon}
+ <div>
+ <p className="text-sm font-medium text-gray-700 dark:text-white">
+ {title}
+ </p>
+ {description && (
+ <p
+ className={cn(
+ "text-xs text-gray-500/80 dark:text-white/60",
+ ["line-clamp-1", "line-clamp-2"][descriptionLines - 1],
+ )}
+ >
+ {description}
+ </p>
+ )}
+ </div>
+ </div>
+ </Link>
+ );
+}
+
+export function ContentIcon({
+ icon: Icon,
+}: {
+ icon: (props: SVGProps<SVGSVGElement>) => JSX.Element;
+}) {
+ return (
+ <div className="shrink-0 rounded-[10px] border border-gray-200 bg-white/50 p-3">
+ <Icon className="h-4 w-4 text-black transition-transform group-hover:scale-110 dark:text-white/80" />
+ </div>
+ );
+}
diff --git a/packages/ui/src/nav/content/solutions-content.tsx b/packages/ui/src/nav/content/solutions-content.tsx
new file mode 100644
index 0000000000..406a38a767
--- /dev/null
+++ b/packages/ui/src/nav/content/solutions-content.tsx
@@ -0,0 +1,48 @@
+import { cn } from "@dub/utils";
+import { PROFILES, SDKS } from "../../content";
+import { ContentProps, createHref } from "../shared";
+import {
+ ContentIcon,
+ ContentLinkCard,
+ contentHeadingClassName,
+} from "./shared";
+
+export function SolutionsContent({ domain }: ContentProps) {
+ return (
+ <div className="grid w-[32rem] grid-cols-[5fr_3fr]">
+ <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 }) => (
+ <ContentLinkCard
+ href={createHref(href, domain)}
+ icon={<ContentIcon icon={icon} />}
+ title={title}
+ description={description}
+ />
+ ))}
+ </div>
+ </div>
+ <div className="border-l border-gray-200 p-5">
+ <p className={cn(contentHeadingClassName, "mb-2")}>SDKs</p>
+ <div className="-mx-2 flex flex-col gap-0.5">
+ {SDKS.map(({ icon: Icon, iconClassName, name, href }) => (
+ <ContentLinkCard
+ key={href}
+ href={createHref(href, domain)}
+ icon={
+ <Icon
+ className={cn(
+ "h-5 w-5 shrink-0 text-gray-600 transition-colors",
+ iconClassName,
+ )}
+ />
+ }
+ title={name}
+ />
+ ))}
+ </div>
+ </div>
+ </div>
+ );
+}
diff --git a/packages/ui/src/nav/nav-mobile.tsx b/packages/ui/src/nav/nav-mobile.tsx
index 8cd2f87bd1..653b3afce4 100644
--- a/packages/ui/src/nav/nav-mobile.tsx
+++ b/packages/ui/src/nav/nav-mobile.tsx
@@ -9,7 +9,7 @@ import useSWR from "swr";
import { FEATURES_LIST } from "../content";
import { type NavTheme } from "./nav";
-export const navItems = [
+const navItems = [
{
name: "Product",
href: "/",
diff --git a/packages/ui/src/nav/nav.tsx b/packages/ui/src/nav/nav.tsx
index ba749b5cdc..4d1c0bef2a 100644
--- a/packages/ui/src/nav/nav.tsx
+++ b/packages/ui/src/nav/nav.tsx
@@ -8,10 +8,12 @@ import Link from "next/link";
import { useParams, useSelectedLayoutSegment } from "next/navigation";
import { PropsWithChildren, createContext } from "react";
import useSWR from "swr";
-import { FEATURES_LIST } from "../content";
import { useScroll } from "../hooks";
import { MaxWidthWrapper } from "../max-width-wrapper";
import { NavLogo } from "../nav-logo";
+import { ProductContent } from "./content/product-content";
+import { SolutionsContent } from "./content/solutions-content";
+import { createHref } from "./shared";
export type NavTheme = "light" | "dark";
@@ -19,7 +21,7 @@ export const NavContext = createContext<{ theme: NavTheme }>({
theme: "light",
});
-export const navItems = [
+const navItems = [
{
name: "Product",
href: "/",
@@ -27,6 +29,7 @@ export const navItems = [
},
{
name: "Solutions",
+ content: SolutionsContent,
},
{
name: "Pricing",
@@ -52,9 +55,6 @@ const navItemStyles = cva(
},
);
-const createHref = (href: string, domain: string) =>
- domain === "dub.co" ? href : `https://dub.co${href}`;
-
export function Nav({ theme = "light" }: { theme?: NavTheme }) {
const { domain = "dub.co" } = useParams() as { domain: string };
@@ -79,12 +79,6 @@ export function Nav({ theme = "light" }: { theme?: NavTheme }) {
<div
className={cn(
"-z-1 absolute inset-0 border-transparent transition-all",
- {
- // "bg-white/75 backdrop-blur-lg dark:bg-black/75": scrolled,
- // "bg-white dark:bg-black":
- // selectedLayout &&
- // HIDE_BACKGROUND_SEGMENTS.includes(selectedLayout),
- },
)}
/>
<MaxWidthWrapper className="relative">
@@ -111,19 +105,19 @@ export function Nav({ theme = "light" }: { theme?: NavTheme }) {
<div className="absolute inset-0 -z-[1]">
<div
className={cn(
- "absolute left-1/2 top-1/2 h-full w-full -translate-x-1/2 -translate-y-1/2 rounded-full border border-gray-200 bg-white drop-shadow-sm transition-all dark:border-white/10 dark:bg-black",
- scrolled && [
- "h-14 w-screen rounded-none drop-shadow-none",
- (!selectedLayout ||
- !HIDE_BACKGROUND_SEGMENTS.includes(selectedLayout)) &&
- "bg-white/75 backdrop-blur-lg dark:bg-black/75",
- ],
+ "absolute left-1/2 top-1/2 h-full w-full -translate-x-1/2 -translate-y-1/2 rounded-full border border-gray-200 drop-shadow-sm transition-all dark:border-white/10",
+ selectedLayout &&
+ HIDE_BACKGROUND_SEGMENTS.includes(selectedLayout)
+ ? "bg-white dark:bg-black"
+ : "bg-white/75 backdrop-blur-lg dark:bg-black/75",
+ scrolled && "h-14 w-screen rounded-none drop-shadow-none",
)}
/>
</div>
{navItems.map(({ name, href, content: Content }) => {
- const isActive = href === `/${selectedLayout}`;
- console.log(href);
+ const isActive =
+ href === `/${selectedLayout}` ||
+ (href === "/" && selectedLayout === null);
return (
<NavigationMenuPrimitive.Item key={href}>
<WithTrigger trigger={!!Content}>
@@ -145,7 +139,12 @@ export function Nav({ theme = "light" }: { theme?: NavTheme }) {
{name}
</Link>
) : (
- <span className={navItemStyles({ isActive })}>
+ <span
+ className={cn(
+ navItemStyles({ isActive }),
+ "cursor-default",
+ )}
+ >
{name}
</span>
)}
@@ -161,7 +160,14 @@ export function Nav({ theme = "light" }: { theme?: NavTheme }) {
})}
</NavigationMenuPrimitive.List>
- <NavigationMenuPrimitive.Viewport className="data-[state=closed]:animate-scale-out-content data-[state=open]:animate-scale-in-content absolute left-0 top-full mt-3 flex w-[var(--radix-navigation-menu-viewport-width)] origin-[top_center] justify-start rounded-[20px] border border-gray-200 bg-white/80 shadow-md backdrop-blur-md dark:border-white/[0.15] dark:bg-black/40" />
+ <NavigationMenuPrimitive.Viewport
+ className={cn(
+ "absolute left-0 top-full mt-3 flex origin-[top_center] justify-start overflow-hidden rounded-[20px] border border-gray-200 bg-white shadow-md dark:border-white/[0.15] dark:bg-black",
+ "data-[state=closed]:animate-scale-out-content data-[state=open]:animate-scale-in-content",
+ "h-[var(--radix-navigation-menu-viewport-height)] w-[var(--radix-navigation-menu-viewport-width)] transition-[width,height]",
+ "[&>*]:absolute",
+ )}
+ />
</NavigationMenuPrimitive.Root>
<div className="hidden grow basis-0 justify-end lg:flex">
@@ -224,39 +230,3 @@ function WithTrigger({
children
);
}
-
-function ProductContent({ domain }: { domain: string }) {
- return (
- <div className="grid w-[32rem] grid-cols-2 gap-1 p-3">
- {FEATURES_LIST.map(({ slug, icon: Icon, title, shortTitle }) => (
- <Link
- key={slug}
- href={createHref(`/${slug}`, domain)}
- {...(domain !== "dub.co" && {
- onClick: () => {
- va.track("Referred from custom domain", {
- domain,
- medium: `navbar item (/${slug})`,
- });
- },
- })}
- className="group rounded-[8px] p-2 transition-colors hover:bg-gray-100 active:bg-gray-200 dark:hover:bg-white/[0.15] dark:active:bg-white/20"
- >
- <div className="flex items-center gap-2">
- <div className="shrink-0 rounded-[10px] border border-gray-200 bg-white/50 p-3">
- <Icon className="h-4 w-4 text-black transition-transform group-hover:scale-110 dark:text-white/80" />
- </div>
- <div>
- <p className="text-sm font-medium text-gray-700 dark:text-white">
- {shortTitle}
- </p>
- <p className="line-clamp-1 text-xs text-gray-500/80 dark:text-white/60">
- {title}
- </p>
- </div>
- </div>
- </Link>
- ))}
- </div>
- );
-}
diff --git a/packages/ui/src/nav/shared.ts b/packages/ui/src/nav/shared.ts
new file mode 100644
index 0000000000..7688e65408
--- /dev/null
+++ b/packages/ui/src/nav/shared.ts
@@ -0,0 +1,4 @@
+export const createHref = (href: string, domain: string) =>
+ domain === "dub.co" ? href : `https://dub.co${href}`;
+
+export type ContentProps = { domain: string };