@rc-component/trigger
Version:
base abstract trigger component for react
32 lines (31 loc) • 956 B
JavaScript
import * as React from 'react';
import CSSMotion from '@rc-component/motion';
import classNames from 'classnames';
const MotionContent = props => {
const {
prefixCls,
children
} = props;
const childNode = typeof children === 'function' ? children() : children;
// motion name: `${prefixCls}-motion-content-fade`, apply in index.less
const motionName = `${prefixCls}-motion-content-fade`;
return /*#__PURE__*/React.createElement(CSSMotion, {
motionAppear: true,
motionLeave: false,
visible: true,
motionName: motionName
}, ({
className: motionClassName,
style: motionStyle
}) => {
const cls = classNames(`${prefixCls}-motion-content`, motionClassName);
return /*#__PURE__*/React.createElement("div", {
className: cls,
style: motionStyle
}, childNode);
});
};
if (process.env.NODE_ENV !== 'production') {
MotionContent.displayName = 'MotionContent';
}
export default MotionContent;