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.

Mobile layout + preview window improvements

Tim Wilson61b3b947e2f3
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/programs/[programId]/branding/branding-settings-form.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/programs/[programId]/branding/branding-settings-form.tsx
deleted file mode 100644
index 2950c1e36f..0000000000
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/programs/[programId]/branding/branding-settings-form.tsx
+++ /dev/null
@@ -1,136 +0,0 @@
-"use client";
-
-import { useBrandingFormContext } from "@/ui/partners/design/branding-form";
-import { ProgramColorPicker } from "@/ui/partners/program-color-picker";
-import { FileUpload } from "@dub/ui";
-import { Plus } from "@dub/ui/icons";
-import { cn } from "@dub/utils/src";
-import { flightRouterStateSchema } from "next/dist/server/app-render/types";
-import { ReactNode, useId } from "react";
-import { Controller } from "react-hook-form";
-
-export function BrandingSettingsForm() {
- const { control } = useBrandingFormContext();
-
- return (
- <div>
- <div className="grid grid-cols-1 gap-10">
- <div className="flex flex-col gap-6">
- <FormRow
- label="Logo"
- description="A square logo that will be used in various parts of your program"
- >
- {(id) => (
- <Controller
- control={control}
- name="logo"
- rules={{ required: flightRouterStateSchema }}
- render={({ field }) => (
- <FileUpload
- id={id}
- accept="images"
- className="h-14 rounded-lg border border-neutral-300 p-1"
- iconClassName="size-4 text-neutral-800"
- previewClassName="object-contain"
- icon={Plus}
- variant="plain"
- imageSrc={field.value}
- readFile
- onChange={({ src }) => field.onChange(src)}
- content={null}
- maxFileSizeMB={2}
- />
- )}
- />
- )}
- </FormRow>
-
- <Divider />
-
- <FormRow
- label="Wordmark"
- description="A full-sized logo used on the program application form"
- >
- {(id) => (
- <Controller
- control={control}
- name="wordmark"
- rules={{ required: false }}
- render={({ field }) => (
- <FileUpload
- id={id}
- accept="images"
- className="h-20 rounded-lg border border-neutral-300 p-1"
- iconClassName="size-4 text-neutral-800"
- previewClassName="object-contain"
- icon={Plus}
- variant="plain"
- imageSrc={field.value}
- readFile
- onChange={({ src }) => field.onChange(src)}
- content={null}
- maxFileSizeMB={2}
- />
- )}
- />
- )}
- </FormRow>
-
- <Divider />
-
- <FormRow label="Brand color" inline>
- {(id) => (
- <Controller
- control={control}
- name="brandColor"
- render={({ field }) => (
- <ProgramColorPicker
- color={field.value}
- onChange={field.onChange}
- id={id}
- />
- )}
- />
- )}
- </FormRow>
- </div>
- </div>
- </div>
- );
-}
-
-const Divider = () => <hr className="border-neutral-300" />;
-
-function FormRow({
- label,
- description,
- inline = false,
- children,
-}: {
- label: string;
- description?: string;
- inline?: boolean;
- children: (id: string) => ReactNode;
-}) {
- const id = useId();
-
- return (
- <div
- className={cn(
- "flex flex-col justify-between gap-6",
- inline && "flex-row items-center",
- )}
- >
- <div className="flex flex-col gap-1">
- <label className="text-sm font-medium text-neutral-800" htmlFor={id}>
- {label}
- </label>
- {description && (
- <p className="text-xs text-neutral-500">{description}</p>
- )}
- </div>
-
- <div>{children(id)}</div>
- </div>
- );
-}
diff --git a/apps/web/ui/partners/design/branding-form.tsx b/apps/web/ui/partners/design/branding-form.tsx
index 49499b9f1b..4649112c64 100644
--- a/apps/web/ui/partners/design/branding-form.tsx
+++ b/apps/web/ui/partners/design/branding-form.tsx
@@ -168,7 +168,7 @@ function BrandingFormInner({
data-state={isSidePanelOpen ? "open" : "closed"}
variant="secondary"
icon={<Brush className="size-4" />}
- className="hidden size-8 p-0 lg:flex"
+ className="size-8 p-0"
/>
</div>
<span className="text-center text-xs font-medium text-neutral-500">
@@ -192,10 +192,10 @@ function BrandingFormInner({
</div>
<div
className={cn(
- "grid h-[calc(100vh-186px)] grid-cols-1 transition-[grid-template-columns]",
+ "grid grid-cols-1 transition-[grid-template-columns,grid-template-rows] lg:h-[calc(100vh-186px)]",
isSidePanelOpen
- ? "lg:grid-cols-[240px_minmax(0,1fr)]"
- : "lg:grid-cols-[0px_minmax(0,1fr)]",
+ ? "max-lg:grid-rows-[453px_minmax(0,1fr)] lg:grid-cols-[240px_minmax(0,1fr)]"
+ : "max-lg:grid-rows-[0px_minmax(0,1fr)] lg:grid-cols-[0px_minmax(0,1fr)]",
)}
>
<div className="h-full overflow-hidden">
@@ -208,7 +208,7 @@ function BrandingFormInner({
<BrandingSettingsForm />
</div>
</div>
- <div className="h-full overflow-hidden px-4 pt-4">
+ <div className="h-full overflow-hidden px-2 pt-2 sm:px-4 sm:pt-4">
<LanderPreview program={program} />
</div>
</div>
diff --git a/apps/web/ui/partners/design/preview-window.tsx b/apps/web/ui/partners/design/preview-window.tsx
index fea1e7b080..bd9157ee4b 100644
--- a/apps/web/ui/partners/design/preview-window.tsx
+++ b/apps/web/ui/partners/design/preview-window.tsx
@@ -14,8 +14,8 @@ export function PreviewWindow({
return (
<div className="flex size-full flex-col overflow-hidden rounded-t-xl border-x border-t border-neutral-200 bg-white shadow-md">
- <div className="flex items-center justify-between border-b border-neutral-200 px-4 py-2.5">
- <div className="flex grow basis-0 items-center gap-2">
+ <div className="flex items-center justify-between gap-2 border-b border-neutral-200 px-4 py-2.5">
+ <div className="hidden grow basis-0 items-center gap-2 sm:flex">
{[...Array(3)].map((_, idx) => (
<div
key={idx}
@@ -34,7 +34,7 @@ export function PreviewWindow({
}
className="group flex min-w-0 max-w-xs grow items-center justify-center rounded-lg bg-neutral-100 px-4 py-1.5"
>
- <div className="relative">
+ <div className="relative min-w-0">
<span className="text-content-emphasis block truncate text-xs font-medium">
{getPrettyUrl(url)}
</span>