Sha256: 1a1c5ddde142fb0d6cefecbbe4397b4ea37d9442940b6c8107a8db00bad23b10

Contents?: true

Size: 522 Bytes

Versions: 129

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

129 entries across 129 versions & 1 rubygems

Version Path
playbook_ui-14.15.0.pre.alpha.play1907passglobalpropstotooltiprails6706 app/pb_kits/playbook/pb_drawer/hooks/useDrawerAnimation.tsx
playbook_ui-14.16.0.pre.rc.3 app/pb_kits/playbook/pb_drawer/hooks/useDrawerAnimation.tsx
playbook_ui-14.15.0.pre.alpha.PBNTR617addgriddisplayglobalprop6700 app/pb_kits/playbook/pb_drawer/hooks/useDrawerAnimation.tsx
playbook_ui-14.15.0.pre.alpha.play1910emptystatekitreactbeta6685 app/pb_kits/playbook/pb_drawer/hooks/useDrawerAnimation.tsx
playbook_ui-14.15.0.pre.alpha.play1757pbcontenttag6677 app/pb_kits/playbook/pb_drawer/hooks/useDrawerAnimation.tsx
playbook_ui-14.15.0.pre.alpha.PLAY1756pbcontenttagpt76661 app/pb_kits/playbook/pb_drawer/hooks/useDrawerAnimation.tsx
playbook_ui-14.15.0.pre.alpha.play1757pbcontenttag6658 app/pb_kits/playbook/pb_drawer/hooks/useDrawerAnimation.tsx
playbook_ui-14.15.0.pre.alpha.play1757pbcontenttag6644 app/pb_kits/playbook/pb_drawer/hooks/useDrawerAnimation.tsx
playbook_ui-14.15.0.pre.alpha.PLAY1871speedupvitebuildwatch6643 app/pb_kits/playbook/pb_drawer/hooks/useDrawerAnimation.tsx
playbook_ui-14.16.0.pre.rc.2 app/pb_kits/playbook/pb_drawer/hooks/useDrawerAnimation.tsx
playbook_ui-14.15.0.pre.alpha.PBNTR900phonenumberinputhidden6620 app/pb_kits/playbook/pb_drawer/hooks/useDrawerAnimation.tsx
playbook_ui-14.15.0.pre.alpha.play1917lodashremoval2of36615 app/pb_kits/playbook/pb_drawer/hooks/useDrawerAnimation.tsx
playbook_ui-14.15.0.pre.alpha.play1917lodashremoval2of36613 app/pb_kits/playbook/pb_drawer/hooks/useDrawerAnimation.tsx
playbook_ui-14.16.0.pre.rc.1 app/pb_kits/playbook/pb_drawer/hooks/useDrawerAnimation.tsx
playbook_ui-14.15.0.pre.alpha.PBNTR900phonenumberinputhidden6593 app/pb_kits/playbook/pb_drawer/hooks/useDrawerAnimation.tsx
playbook_ui-14.15.0.pre.alpha.PBNTR902multilevelselecthiddeninputbug6580 app/pb_kits/playbook/pb_drawer/hooks/useDrawerAnimation.tsx
playbook_ui-14.15.0.pre.alpha.play1910emptystatekitreactbeta6579 app/pb_kits/playbook/pb_drawer/hooks/useDrawerAnimation.tsx
playbook_ui-14.15.0.pre.alpha.play1854reacthookmultilvlselect6572 app/pb_kits/playbook/pb_drawer/hooks/useDrawerAnimation.tsx
playbook_ui-14.16.0.pre.rc.0 app/pb_kits/playbook/pb_drawer/hooks/useDrawerAnimation.tsx
playbook_ui-14.14.0.pre.alpha.PBNTR907reactfilterpopoverpropswidthbug6557 app/pb_kits/playbook/pb_drawer/hooks/useDrawerAnimation.tsx