import { Transition } from '@douyinfe/semi-animation-react'; import PropTypes from 'prop-types'; import React, { useState } from 'react'; import { Motion } from '@douyinfe/semi-foundation/utils/type'; const ease = 'cubicBezier(.25,.1,.25,1)'; const formatStyle = function formatStyle({ maxHeight, opacity }: { maxHeight: number; opacity: number }) { return { maxHeight, opacity, }; }; export interface SubNavTransitionProps { children?: React.ReactNode | ((transitionProps?: any) => React.ReactNode); isCollapsed?: boolean; maxHeight?: number; motion?: Motion; } function SubNavTransition(props: SubNavTransitionProps = {}) { const { children, isCollapsed, maxHeight = 999 } = props; // eslint-disable-next-line no-unused-vars const [immediate, setImmediate] = useState(false); // useEffect(() => { // setImmediate(isCollapsed); // }, [isCollapsed]); return ( {typeof children === 'function' ? (transitionStyle: { maxHeight: number; opacity: number }) => children(formatStyle(transitionStyle)) : children} ); } SubNavTransition.propTypes = { children: PropTypes.any, isCollapsed: PropTypes.bool, }; export default SubNavTransition;