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.

Improve animations

Tim Wilsone8dfa2ef41ea
diff --git a/apps/web/ui/partners/design/edit-list.tsx b/apps/web/ui/partners/design/edit-list.tsx
index a5b8ff53d4..b5d1df5357 100644
--- a/apps/web/ui/partners/design/edit-list.tsx
+++ b/apps/web/ui/partners/design/edit-list.tsx
@@ -92,6 +92,10 @@ export function EditListItem({
dragListener={false}
dragControls={controls}
className="relative overflow-hidden rounded-md border border-neutral-200 bg-neutral-50"
+ initial={{ opacity: 0, height: 0 }}
+ animate={{ opacity: 1, height: "auto" }}
+ exit={{ opacity: 0, height: 0 }}
+ transition={{ duration: 0.15 }}
>
<div className="relative">
<div
@@ -129,7 +133,7 @@ export function EditListItem({
overflow: "hidden",
}}
transition={{
- duration: 0.2,
+ duration: 0.15,
}}
initial={false}
>
diff --git a/apps/web/ui/partners/design/modals/accordion-block-modal.tsx b/apps/web/ui/partners/design/modals/accordion-block-modal.tsx
index 54606de968..83116fd315 100644
--- a/apps/web/ui/partners/design/modals/accordion-block-modal.tsx
+++ b/apps/web/ui/partners/design/modals/accordion-block-modal.tsx
@@ -1,13 +1,7 @@
"use client";
import { programLanderAccordionBlockSchema } from "@/lib/zod/schemas/program-lander";
-import {
- AnimatedSizeContainer,
- Button,
- Modal,
- useMediaQuery,
- useScrollProgress,
-} from "@dub/ui";
+import { Button, Modal, useMediaQuery, useScrollProgress } from "@dub/ui";
import { Dispatch, SetStateAction, useId, useRef } from "react";
import { FormProvider, useForm } from "react-hook-form";
import { v4 as uuid } from "uuid";
@@ -103,100 +97,95 @@ function AccordionBlockModalInner({
<div
ref={scrollRef}
onScroll={updateScrollProgress}
- className="scrollbar-hide relative max-h-[calc(100vh-300px)] overflow-y-auto"
+ className="scrollbar-hide relative -my-2 max-h-[calc(100vh-300px)] overflow-y-auto py-2"
>
- <AnimatedSizeContainer
- //height
- transition={{ ease: "easeInOut", duration: 0.2 }}
- >
- <EditList
- values={fields.map(({ id }) => id)}
- onAdd={() => {
- const id = uuid();
+ <EditList
+ values={fields.map(({ id }) => id)}
+ onAdd={() => {
+ const id = uuid();
- setValue(
- "items",
- [
- ...fields,
- {
- id,
- title: `Item ${fields.length + 1}`,
- content: "",
- },
- ],
- { shouldDirty: true },
- );
+ setValue(
+ "items",
+ [
+ ...fields,
+ {
+ id,
+ title: `Item ${fields.length + 1}`,
+ content: "",
+ },
+ ],
+ { shouldDirty: true },
+ );
- return id;
- }}
- onReorder={(updated) =>
- setValue(
- "items",
- updated.map((id) => fields.find((f) => f.id === id)!),
- { shouldDirty: true },
- )
- }
- >
- {fields.map((field, index) => (
- <EditListItem
- key={field.id}
- value={field.id}
- title={field.title || "Item"}
- onRemove={
- fields.length > 1
- ? () =>
- setValue(
- "items",
- fields.filter(({ id }) => id !== field.id),
- { shouldDirty: true },
- )
- : undefined
- }
- >
- <div className="flex flex-col gap-6">
- {/* Title */}
- <div>
- <label
- htmlFor={`${id}-${field.id}-title`}
- className="flex items-center gap-2 text-sm font-medium text-neutral-700"
- >
- Title
- </label>
- <div className="mt-2 rounded-md shadow-sm">
- <input
- id={`${id}-${field.id}-title`}
- type="text"
- placeholder="Title"
- className="block w-full rounded-md border-neutral-300 text-neutral-900 placeholder-neutral-400 focus:border-neutral-500 focus:outline-none focus:ring-neutral-500 sm:text-sm"
- {...register(`items.${index}.title`)}
- />
- </div>
+ return id;
+ }}
+ onReorder={(updated) =>
+ setValue(
+ "items",
+ updated.map((id) => fields.find((f) => f.id === id)!),
+ { shouldDirty: true },
+ )
+ }
+ >
+ {fields.map((field, index) => (
+ <EditListItem
+ key={field.id}
+ value={field.id}
+ title={field.title || "Item"}
+ onRemove={
+ fields.length > 1
+ ? () =>
+ setValue(
+ "items",
+ fields.filter(({ id }) => id !== field.id),
+ { shouldDirty: true },
+ )
+ : undefined
+ }
+ >
+ <div className="flex flex-col gap-6">
+ {/* Title */}
+ <div>
+ <label
+ htmlFor={`${id}-${field.id}-title`}
+ className="flex items-center gap-2 text-sm font-medium text-neutral-700"
+ >
+ Title
+ </label>
+ <div className="mt-2 rounded-md shadow-sm">
+ <input
+ id={`${id}-${field.id}-title`}
+ type="text"
+ placeholder="Title"
+ className="block w-full rounded-md border-neutral-300 text-neutral-900 placeholder-neutral-400 focus:border-neutral-500 focus:outline-none focus:ring-neutral-500 sm:text-sm"
+ {...register(`items.${index}.title`)}
+ />
</div>
+ </div>
- {/* Content */}
- <div>
- <label
- htmlFor={`${id}-${field.id}-content`}
- className="flex items-center gap-2 text-sm font-medium text-neutral-700"
- >
- Content
- </label>
- <div className="mt-2 rounded-md shadow-sm">
- <textarea
- id={`${id}-${field.id}-content`}
- rows={3}
- maxLength={1000}
- placeholder="Start typing"
- className="block max-h-32 min-h-16 w-full rounded-md border-neutral-300 text-neutral-900 placeholder-neutral-400 focus:border-neutral-500 focus:outline-none focus:ring-neutral-500 sm:text-sm"
- {...register(`items.${index}.content`)}
- />
- </div>
+ {/* Content */}
+ <div>
+ <label
+ htmlFor={`${id}-${field.id}-content`}
+ className="flex items-center gap-2 text-sm font-medium text-neutral-700"
+ >
+ Content
+ </label>
+ <div className="mt-2 rounded-md shadow-sm">
+ <textarea
+ id={`${id}-${field.id}-content`}
+ rows={3}
+ maxLength={1000}
+ placeholder="Start typing"
+ className="block max-h-32 min-h-16 w-full rounded-md border-neutral-300 text-neutral-900 placeholder-neutral-400 focus:border-neutral-500 focus:outline-none focus:ring-neutral-500 sm:text-sm"
+ {...register(`items.${index}.content`)}
+ />
</div>
</div>
- </EditListItem>
- ))}
- </EditList>
- </AnimatedSizeContainer>
+ </div>
+ </EditListItem>
+ ))}
+ </EditList>
{/* Bottom scroll fade */}
<div