Sha256: 1a1c5ddde142fb0d6cefecbbe4397b4ea37d9442940b6c8107a8db00bad23b10
Contents?: true
Size: 522 Bytes
Versions: 1
Compression:
Stored size: 522 Bytes
Contents
import { useState, useEffect } from 'react' export const useDrawerAnimation = (isOpen: boolean) => { const [animationState, setAnimationState] = useState('') useEffect(() => { if (isOpen) { setAnimationState('afterOpen') } else if (!isOpen && animationState === 'afterOpen') { setAnimationState('beforeClose') setTimeout(() => { setAnimationState('') }, 200) } }, [isOpen]) return { animationState, isVisible: isOpen || animationState === 'beforeClose' } }
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
playbook_ui-14.11.1.pre.alpha.PLAY17445539 | app/pb_kits/playbook/pb_drawer/hooks/useDrawerAnimation.tsx |