From ef7863ad0b06669887ee806b5eeaeaf195aaa35f Mon Sep 17 00:00:00 2001 From: sean-brydon <55134778+sean-brydon@users.noreply.github.com> Date: Mon, 12 Sep 2022 11:15:30 +0100 Subject: [PATCH] Simple animations (#4378) --- apps/web/pages/v2/availability/index.tsx | 12 +++++++++++- apps/web/pages/v2/bookings/[status].tsx | 12 ++++++++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/apps/web/pages/v2/availability/index.tsx b/apps/web/pages/v2/availability/index.tsx index 5b5be8c11f..280eec5ad1 100644 --- a/apps/web/pages/v2/availability/index.tsx +++ b/apps/web/pages/v2/availability/index.tsx @@ -1,3 +1,6 @@ +import autoAnimate from "@formkit/auto-animate"; +import { useRef, useEffect } from "react"; + import { NewScheduleButton, ScheduleListItem } from "@calcom/features/schedules"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { inferQueryOutput, trpc } from "@calcom/trpc/react"; @@ -13,6 +16,7 @@ import SkeletonLoader from "@components/availability/SkeletonLoader"; export function AvailabilityList({ schedules }: inferQueryOutput<"viewer.availability.list">) { const { t } = useLocale(); const utils = trpc.useContext(); + const animationParentRef = useRef(null); const meQuery = trpc.useQuery(["viewer.me"]); @@ -28,6 +32,12 @@ export function AvailabilityList({ schedules }: inferQueryOutput<"viewer.availab } }, }); + + // Adds smooth delete button - item fades and old item slides into place + useEffect(() => { + animationParentRef.current && autoAnimate(animationParentRef.current); + }, [animationParentRef]); + return ( <> {schedules.length === 0 ? ( @@ -41,7 +51,7 @@ export function AvailabilityList({ schedules }: inferQueryOutput<"viewer.availab ) : (
-