diff --git a/src/components/ui/fab/FABContainer.tsx b/src/components/ui/fab/FABContainer.tsx index 203d2a05e4..00911bf265 100644 --- a/src/components/ui/fab/FABContainer.tsx +++ b/src/components/ui/fab/FABContainer.tsx @@ -1,9 +1,10 @@ 'use client' import React, { useEffect, useState } from 'react' +import { AnimatePresence, motion } from 'framer-motion' +import type { HTMLMotionProps } from 'framer-motion' import type { PropsWithChildren } from 'react' -import { useStateToRef } from '~/hooks/common/use-state-ref' import { clsxm } from '~/utils/helper' export interface FABConfig { @@ -59,53 +60,33 @@ export const FABBase = ( id: string show?: boolean children: JSX.Element - } & React.DetailedHTMLProps< - React.ButtonHTMLAttributes, - HTMLButtonElement - > + } & HTMLMotionProps<'button'> >, ) => { const { children, show = true, ...extra } = props - const { className, onTransitionEnd, ...rest } = extra - - const [mounted, setMounted] = useState(true) - const [appearTransition, setAppearTransition] = useState(false) - const getMounted = useStateToRef(mounted) - const handleTransitionEnd: React.TransitionEventHandler = ( - e, - ) => { - onTransitionEnd?.(e) - - !show && setMounted(false) - } - - useEffect(() => { - if (show && !getMounted.current) { - setAppearTransition(true) - setMounted(true) - - requestAnimationFrame(() => { - setAppearTransition(false) - }) - } - }, [show]) + const { className, ...rest } = extra return ( - + ) }