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.

fix a few things

Steven Tey5f0aa8a71da5
diff --git a/apps/web/app/banned/page.tsx b/apps/web/app/banned/page.tsx
index 432699e85d..3df03ad137 100644
--- a/apps/web/app/banned/page.tsx
+++ b/apps/web/app/banned/page.tsx
@@ -1,4 +1,4 @@
-import { Background, Footer, Nav } from "@dub/ui";
+import { Background, Footer, Nav, NavMobile } from "@dub/ui";
import { constructMetadata } from "@dub/utils";
import { ShieldBan } from "lucide-react";
@@ -13,6 +13,7 @@ export const metadata = constructMetadata({
export default async function BannedPage() {
return (
<main className="flex min-h-screen flex-col justify-between">
+ <NavMobile />
<Nav />
<div className="z-10 mx-2 my-10 flex max-w-md flex-col items-center space-y-5 px-2.5 text-center sm:mx-auto sm:max-w-lg sm:px-0 lg:mb-16">
<div className="mx-auto flex h-20 w-20 items-center justify-center rounded-full border border-gray-300 bg-white/30">
diff --git a/apps/web/app/expired/[domain]/page.tsx b/apps/web/app/expired/[domain]/page.tsx
index c58bfbb7d5..82449a1438 100644
--- a/apps/web/app/expired/[domain]/page.tsx
+++ b/apps/web/app/expired/[domain]/page.tsx
@@ -1,5 +1,5 @@
import { getLinkViaEdge } from "@/lib/planetscale";
-import { Background, Footer, Nav } from "@dub/ui";
+import { Background, Footer, Nav, NavMobile } from "@dub/ui";
import { constructMetadata } from "@dub/utils";
import { TimerOff } from "lucide-react";
import { redirect } from "next/navigation";
@@ -26,6 +26,7 @@ export default async function ExpiredPage({
return (
<main className="flex min-h-screen flex-col justify-between">
+ <NavMobile />
<Nav />
<div className="z-10 mx-2 my-10 flex max-w-md flex-col items-center space-y-5 px-2.5 text-center sm:mx-auto sm:max-w-lg sm:px-0 lg:mb-16">
<div className="mx-auto flex h-20 w-20 items-center justify-center rounded-full border border-gray-300 bg-white/30">
diff --git a/apps/web/app/inspect/[domain]/[key]/page.tsx b/apps/web/app/inspect/[domain]/[key]/page.tsx
index 83179ef721..a37716b3ac 100644
--- a/apps/web/app/inspect/[domain]/[key]/page.tsx
+++ b/apps/web/app/inspect/[domain]/[key]/page.tsx
@@ -5,6 +5,7 @@ import {
LinkPreview,
LinkPreviewPlaceholder,
Nav,
+ NavMobile,
} from "@dub/ui";
import {
GOOGLE_FAVICON_URL,
@@ -61,6 +62,7 @@ export default async function InspectPage({
return (
<>
<main className="flex min-h-screen flex-col justify-between">
+ <NavMobile />
<Nav />
<div className="z-10 mx-2 my-10 flex max-w-md flex-col space-y-5 px-2.5 text-center sm:mx-auto sm:max-w-lg sm:px-0 lg:mb-16">
<h1 className="font-display text-5xl font-extrabold leading-[1.15] text-black sm:text-6xl sm:leading-[1.15]">
diff --git a/packages/ui/package.json b/packages/ui/package.json
index b3e87d173c..eafb267527 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.1.27",
+ "version": "0.1.28",
"sideEffects": false,
"main": "./dist/index.js",
"module": "./dist/index.mjs",
diff --git a/packages/ui/src/nav/nav-mobile.tsx b/packages/ui/src/nav/nav-mobile.tsx
index 37402d8e84..8d601ecaea 100644
--- a/packages/ui/src/nav/nav-mobile.tsx
+++ b/packages/ui/src/nav/nav-mobile.tsx
@@ -8,6 +8,7 @@ import { ElementType, useEffect, useState } from "react";
import useSWR from "swr";
import { AnimatedSizeContainer } from "../animated-size-container";
import { navItems, type NavTheme } from "./nav";
+import { createHref } from "./shared";
export function NavMobile({ theme = "light" }: { theme?: NavTheme }) {
const { domain = "dub.co" } = useParams() as { domain: string };
@@ -34,7 +35,7 @@ export function NavMobile({ theme = "light" }: { theme?: NavTheme }) {
<button
onClick={() => setOpen(!open)}
className={cn(
- "fixed right-3 top-3 z-40 rounded-full p-2 transition-colors duration-200 hover:bg-gray-200 focus:outline-none active:bg-gray-300 dark:hover:bg-white/20 dark:active:bg-white/30 lg:hidden",
+ "fixed right-3 top-3 z-40 rounded-full p-2 transition-colors duration-200 hover:bg-gray-200 focus:outline-none active:bg-gray-300 lg:hidden dark:hover:bg-white/20 dark:active:bg-white/30",
open && "hover:bg-gray-100 active:bg-gray-200",
)}
>
@@ -46,7 +47,7 @@ export function NavMobile({ theme = "light" }: { theme?: NavTheme }) {
</button>
<nav
className={cn(
- "fixed inset-0 z-20 hidden w-full bg-white px-5 py-16 dark:bg-black dark:text-white/70 lg:hidden",
+ "fixed inset-0 z-20 hidden w-full bg-white px-5 py-16 lg:hidden dark:bg-black dark:text-white/70",
open && "block",
)}
>
@@ -137,9 +138,7 @@ const MobileNavItem = ({
{childItems.map(({ title, href, icon: Icon, iconClassName }) => (
<Link
key={href}
- href={
- domain === "dub.co" ? `/${href}` : `https://dub.co/${href}`
- }
+ href={createHref(href, domain)}
onClick={() => setOpen(false)}
className="flex w-full space-x-2"
>
@@ -159,10 +158,14 @@ const MobileNavItem = ({
);
}
+ if (!href) {
+ return null;
+ }
+
return (
<li className="py-3">
<Link
- href={domain === "dub.co" ? `/${href}` : `https://dub.co/${href}`}
+ href={createHref(href, domain)}
onClick={() => setOpen(false)}
className="flex w-full font-semibold capitalize"
>