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 Preview

Tim Wilsona42ab8272618
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/programs/[programId]/settings/branding/branding-preview.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/programs/[programId]/settings/branding/branding-preview.tsx
new file mode 100644
index 0000000000..20ea3ec849
--- /dev/null
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/programs/[programId]/settings/branding/branding-preview.tsx
@@ -0,0 +1,57 @@
+"use client";
+
+import { LockFill, ToggleGroup } from "@dub/ui";
+import { useState } from "react";
+
+const TABS = [
+ { id: "portal", label: "Partner portal" },
+ { id: "application", label: "Applicant form" },
+ { id: "embed", label: "Embed" },
+] as const;
+
+export function BrandingPreview() {
+ const [tab, setTab] = useState<(typeof TABS)[number]["id"]>(TABS[0]["id"]);
+
+ return (
+ <div className="rounded-xl bg-neutral-50 px-8 py-6">
+ <div className="flex justify-between">
+ <span className="text-sm font-semibold text-black">Preview</span>
+ <ToggleGroup
+ options={TABS.map(({ id, label }) => ({
+ value: id,
+ label,
+ }))}
+ selected={tab}
+ selectAction={(tab) => setTab(tab as any)}
+ className="border-0 bg-transparent p-0"
+ optionClassName="text-xs text-neutral-600 data-[selected=true]:text-neutral-900 hover:text-black px-2.5 py-2 leading-none"
+ indicatorClassName="bg-neutral-100 border-neutral-200"
+ />
+ </div>
+ <div className="flex size-full items-center justify-center">
+ <div className="w-full p-1">
+ <div className="w-full rounded-xl border border-neutral-200">
+ <div className="flex items-center justify-between gap-4 rounded-[inherit] bg-white px-4 py-1.5">
+ <div className="hidden grow basis-0 items-center gap-2 sm:flex">
+ {[...Array(3)].map((_, idx) => (
+ <div
+ key={idx}
+ className="size-[9px] rounded-full bg-neutral-200"
+ />
+ ))}
+ </div>
+ <div className="relative flex min-w-0 grow items-center justify-center gap-2 truncate rounded-md bg-neutral-50 px-2 py-1">
+ <LockFill className="size-2.5 shrink-0 text-neutral-900" />
+ <span className="select-none truncate text-sm text-xs font-medium leading-none">
+ partners.dub.co
+ </span>
+ </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>
+ </div>
+ </div>
+ );
+}
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/programs/[programId]/settings/branding/branding-settings.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/programs/[programId]/settings/branding/branding-settings.tsx
index ecd200c3c1..7646ea482f 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/programs/[programId]/settings/branding/branding-settings.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/programs/[programId]/settings/branding/branding-settings.tsx
@@ -13,6 +13,7 @@ import { ReactNode, useId } from "react";
import { Controller, useForm } from "react-hook-form";
import { toast } from "sonner";
import { mutate } from "swr";
+import { BrandingPreview } from "./branding-preview";
export function BrandingSettings() {
const { program } = useProgram();
@@ -73,7 +74,7 @@ function BrandingSettingsForm({ program }: { program: ProgramProps }) {
reset(data);
})}
>
- <div className="grid grid-cols-1 gap-10 px-6 py-8 md:grid-cols-[340px_minmax(0,1fr)]">
+ <div className="grid grid-cols-1 gap-10 px-6 py-8 min-[1200px]:grid-cols-[340px_minmax(0,1fr)]">
<div className="flex flex-col gap-6">
<div>
<h2 className="text-lg font-semibold text-neutral-900">
@@ -169,9 +170,7 @@ function BrandingSettingsForm({ program }: { program: ProgramProps }) {
<Divider />
</div>
- <div className="rounded-xl bg-neutral-50 px-8 py-6">
- <span className="text-sm font-semibold text-black">Preview</span>
- </div>
+ <BrandingPreview />
</div>
<div className="flex items-center justify-end rounded-b-lg border-t border-neutral-200 bg-neutral-50 px-6 py-5">
diff --git a/packages/ui/src/icons/nucleo/index.ts b/packages/ui/src/icons/nucleo/index.ts
index 8913ff9f77..e10b42a539 100644
--- a/packages/ui/src/icons/nucleo/index.ts
+++ b/packages/ui/src/icons/nucleo/index.ts
@@ -112,6 +112,7 @@ export * from "./lines-y";
export * from "./link-broken";
export * from "./link4";
export * from "./location-pin";
+export * from "./lock-fill";
export * from "./magnifier";
export * from "./map-position";
export * from "./menu3";
diff --git a/packages/ui/src/icons/nucleo/lock-fill.tsx b/packages/ui/src/icons/nucleo/lock-fill.tsx
new file mode 100644
index 0000000000..7ab2444ad9
--- /dev/null
+++ b/packages/ui/src/icons/nucleo/lock-fill.tsx
@@ -0,0 +1,18 @@
+import { SVGProps } from "react";
+
+export function LockFill(props: SVGProps<SVGSVGElement>) {
+ return (
+ <svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg" {...props}>
+ <g fill="currentColor">
+ <path
+ d="M12.25,9c-.414,0-.75-.336-.75-.75v-3.25c0-1.378-1.122-2.5-2.5-2.5s-2.5,1.122-2.5,2.5v3.25c0,.414-.336,.75-.75,.75s-.75-.336-.75-.75v-3.25c0-2.206,1.794-4,4-4s4,1.794,4,4v3.25c0,.414-.336,.75-.75,.75Z"
+ fill="currentColor"
+ />
+ <path
+ d="M12.75,7.5H5.25c-1.517,0-2.75,1.233-2.75,2.75v4c0,1.517,1.233,2.75,2.75,2.75h7.5c1.517,0,2.75-1.233,2.75-2.75v-4c0-1.517-1.233-2.75-2.75-2.75Zm-3,5.25c0,.414-.336,.75-.75,.75s-.75-.336-.75-.75v-1c0-.414,.336-.75,.75-.75s.75,.336,.75,.75v1Z"
+ fill="currentColor"
+ />
+ </g>
+ </svg>
+ );
+}
diff --git a/packages/ui/src/toggle-group.tsx b/packages/ui/src/toggle-group.tsx
index 2566f823a0..bb65bff8d8 100644
--- a/packages/ui/src/toggle-group.tsx
+++ b/packages/ui/src/toggle-group.tsx
@@ -43,6 +43,7 @@ export function ToggleGroup({
<button
key={option.value}
type="button"
+ data-selected={option.value === selected}
className={cn(
"relative z-10 flex items-center gap-2 px-3 py-1 text-sm font-medium capitalize",
{