'use client'; import { RippleProps } from './ripple.types'; import { rippleAreaContext } from './ripple-effect'; import React, { useContext, useLayoutEffect, useState } from 'react'; const Ripple = ({ rippleX, rippleY, rippleS, lifetime, rippleKey, endLifetime, }: RippleProps) => { const [classes, setClasses] = useState('m3 ripple visible'); const rippleDomainContext = useContext(rippleAreaContext); useLayoutEffect(() => { if (endLifetime && !rippleDomainContext) { setClasses('m3 ripple'); setTimeout(() => endLifetime(rippleKey), lifetime); } }, [rippleDomainContext]); return ( ); }; export { Ripple };