The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
improve animation
Steven Tey3350bdb329b4
diff --git a/apps/web/app/app.dub.co/(new-program)/[slug]/programs/new/form.tsx b/apps/web/app/app.dub.co/(new-program)/[slug]/programs/new/form.tsxindex d0a12614c5..034fcd7309 100644--- a/apps/web/app/app.dub.co/(new-program)/[slug]/programs/new/form.tsx+++ b/apps/web/app/app.dub.co/(new-program)/[slug]/programs/new/form.tsx@@ -8,7 +8,6 @@ import DomainConfiguration from "@/ui/domains/domain-configuration";import { DomainSelector } from "@/ui/domains/domain-selector";import {Button,- CircleCheck,FileUpload,InfoTooltip,Input,@@ -17,11 +16,10 @@ import {useMediaQuery,} from "@dub/ui";import { ArrowTurnRight2 } from "@dub/ui/icons";-import { fetcher, getApexDomain } from "@dub/utils";-import { motion } from "framer-motion";+import { fetcher, getApexDomain, getPrettyUrl } from "@dub/utils";+import { AnimatePresence, motion } from "framer-motion";import { Plus } from "lucide-react";import { useAction } from "next-safe-action/hooks";-import Link from "next/link";import { useRouter } from "next/navigation";import { useState } from "react";import { Controller, useFormContext } from "react-hook-form";@@ -211,34 +209,22 @@ export function Form() {</p></div>- {domain && verificationData && (- <motion.div- initial={false}- animate={{ height: "auto" }}- className="mt-6 overflow-hidden rounded-md border border-neutral-200 bg-neutral-50 px-5 pb-5"- >- {verificationData.status === "Valid Configuration" ? (- <div className="mt-4 flex items-center gap-2 text-pretty rounded-lg bg-green-100/80 p-3 text-sm text-green-600">- <CircleCheck className="h-5 w-5 shrink-0" />- <div>- Good news! Your DNS records are set up correctly, but it can- take some time for them to propagate globally.{" "}- <Link- href="https://dub.co/help/article/how-to-add-custom-domain#how-long-do-i-have-to-wait-for-my-domain-to-work"- target="_blank"- className="underline transition-colors hover:text-green-800"- >- Learn more.- </Link>- </div>- </div>- ) : (- <div className="mt-4">+ <AnimatePresence>+ {domain &&+ verificationData &&+ verificationData.status !== "Valid Configuration" && (+ <motion.div+ key="domain-verification"+ initial={{ height: 0, opacity: 0 }}+ animate={{ height: "auto", opacity: 1 }}+ exit={{ height: 0, opacity: 0 }}+ transition={{ duration: 0.2 }}+ className="mt-6 overflow-hidden rounded-md border border-neutral-200 bg-neutral-50 px-5 pb-5"+ ><DomainConfiguration data={verificationData} />- </div>+ </motion.div>)}- </motion.div>- )}+ </AnimatePresence><div className="space-y-2"><label className="block text-sm font-medium text-neutral-800">@@ -256,51 +242,62 @@ export function Form() {</div></div>- <div className="space-y-2">- <h2 className="text-base font-medium text-neutral-900">- Partner preview- </h2>+ <AnimatePresence>+ {domain && (+ <motion.div+ key="partner-preview"+ initial={{ height: 0, opacity: 0 }}+ animate={{ height: "auto", opacity: 1 }}+ exit={{ height: 0, opacity: 0 }}+ transition={{ duration: 0.2 }}+ className="space-y-2"+ >+ <h2 className="text-base font-medium text-neutral-900">+ Partner link preview+ </h2>- <div className="rounded-2xl bg-neutral-50 p-2">- <div className="flex items-center gap-3 rounded-xl border border-neutral-200 bg-white p-4">- <div className="relative flex shrink-0 items-center">- <div className="absolute inset-0 h-8 w-8 rounded-full border border-neutral-200 sm:h-10 sm:w-10">- <div className="h-full w-full rounded-full border border-white bg-gradient-to-t from-neutral-100" />- </div>- <div className="relative z-10 p-2">- {url ? (- <LinkLogo- apexDomain={getApexDomain(url)}- className="size-4 sm:size-6"- imageProps={{- loading: "lazy",- }}- />- ) : (- <div className="size-4 rounded-full bg-neutral-200 sm:size-6" />- )}- </div>- </div>+ <div className="rounded-2xl bg-neutral-50 p-2">+ <div className="flex items-center gap-3 rounded-xl border border-neutral-200 bg-white p-4">+ <div className="relative flex shrink-0 items-center">+ <div className="absolute inset-0 h-8 w-8 rounded-full border border-neutral-200 sm:h-10 sm:w-10">+ <div className="h-full w-full rounded-full border border-white bg-gradient-to-t from-neutral-100" />+ </div>+ <div className="relative z-10 p-2">+ {url ? (+ <LinkLogo+ apexDomain={getApexDomain(url)}+ className="size-4 sm:size-6"+ imageProps={{+ loading: "lazy",+ }}+ />+ ) : (+ <div className="size-4 rounded-full bg-neutral-200 sm:size-6" />+ )}+ </div>+ </div>- <div className="min-w-0 flex-1 space-y-0.5">- <div className="truncate text-sm font-medium text-neutral-700">- {linkStructureOptions?.[0].example}- </div>+ <div className="min-w-0 flex-1 space-y-0.5">+ <div className="truncate text-sm font-medium text-neutral-700">+ {linkStructureOptions?.[0].example}+ </div>- <div className="flex min-h-[20px] items-center gap-1 text-sm text-neutral-500">- {url ? (- <>- <ArrowTurnRight2 className="h-3 w-3 shrink-0 text-neutral-400" />- <span className="truncate">{url}</span>- </>- ) : (- <div className="h-3 w-1/2 rounded-md bg-neutral-200" />- )}+ <div className="flex min-h-[20px] items-center gap-1 text-sm text-neutral-500">+ {url ? (+ <>+ <ArrowTurnRight2 className="h-3 w-3 shrink-0 text-neutral-400" />+ <span className="truncate">{getPrettyUrl(url)}</span>+ </>+ ) : (+ <div className="h-3 w-1/2 rounded-md bg-neutral-200" />+ )}+ </div>+ </div></div></div>- </div>- </div>- </div>+ </motion.div>+ )}+ </AnimatePresence><Buttontext="Continue"