@gechiui/block-editor
Version:
49 lines (43 loc) • 906 B
JavaScript
/**
* External dependencies
*/
import { animated } from '@react-spring/web';
import classnames from 'classnames';
/**
* GeChiUI dependencies
*/
import { __experimentalTreeGridRow as TreeGridRow } from '@gechiui/components';
/**
* Internal dependencies
*/
import useMovingAnimation from '../use-moving-animation';
const AnimatedTreeGridRow = animated( TreeGridRow );
export default function ListViewLeaf( {
isSelected,
position,
level,
rowCount,
children,
className,
path,
...props
} ) {
const ref = useMovingAnimation( {
isSelected,
adjustScrolling: false,
enableAnimation: true,
triggerAnimationOnChange: path,
} );
return (
<AnimatedTreeGridRow
ref={ ref }
className={ classnames( 'block-editor-list-view-leaf', className ) }
level={ level }
positionInSet={ position }
setSize={ rowCount }
{ ...props }
>
{ children }
</AnimatedTreeGridRow>
);
}