UNPKG

@atlaskit/navigation-system

Version:

Page layout and navigation components for Atlassian apps.

16 lines (15 loc) • 590 B
import { useEffect, useState } from 'react'; /** * Keep the delayed content fade attached after the shorter panel slide finishes. */ export function usePanelContentEnter(state) { const [hasEntered, setHasEntered] = useState(state === 'entering'); useEffect(() => { if (state !== 'visible') { setHasEntered(state === 'entering'); } }, [state]); // Exit/hidden removes the animation so reopening starts a fresh fade. A panel // initially mounted as visible should not gain an entrance animation. return state === 'entering' || state === 'visible' && hasEntered; }