HEX
Server: Apache
System: Linux efa57bbe-abb1-400d-2985-3b056fbc2701.secureserver.net 6.1.147-1.el9.elrepo.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Jul 24 12:33:32 EDT 2025 x86_64
User: root (0)
PHP: 8.0.30.4
Disabled: NONE
Upload Files
File: //var/www/wp-content/mu-plugins/vendor/wpex/godaddy-launch/src/publish-guide/components/animated.js
/**
 * External dependencies
 */
import useMeasure from 'react-use-measure';
import { animated, config as springConfig, useSpring } from 'react-spring';

/**
 * WordPress dependencies
 */
import { cloneElement } from '@wordpress/element';

export default function Animated( props ) {
	const {
		children,
		config = springConfig.default,
		isCollapsed = false,
	} = props;

	const [ ref, { height } ] = useMeasure();

	const styles = useSpring( {
		config,
		from: { height: 0, opacity: 0 },
		to: { height: isCollapsed ? 0 : height, opacity: isCollapsed ? 0 : 1 },
	} );

	return (
		<animated.div style={ { overflow: 'hidden', ...styles } }>
			{ cloneElement( children, { ref } ) }
		</animated.div>
	);
}