UNPKG

@zohodesk/components

Version:

In this Package, we Provide Some Basic Components to Build Web App

52 lines (50 loc) 1.44 kB
import React from 'react'; import { defaultProps } from "./props/defaultProps"; import { propTypes } from "./props/propTypes"; import { CSSTransition } from 'react-transition-group'; import { animationStyle } from "./utils"; export default class Animation extends React.Component { constructor(props) { super(props); } render() { let { name, enterDuration, exitDuration, children, isActive, unmountOnExit, onEntered = () => {}, onExit = () => {}, delayClassName = null } = this.props; let newClassNames = delayClassName ? Object.assign({}, animationStyle[name], { exit: `${delayClassName} ${animationStyle[name].exit}` }) : animationStyle[name]; return /*#__PURE__*/React.createElement(CSSTransition, { classNames: newClassNames && newClassNames, in: isActive, appear: true, enter: true, exit: true, mountOnEnter: false, unmountOnExit: unmountOnExit, timeout: { enter: enterDuration, exit: exitDuration }, onEntered: onEntered, onExit: onExit }, /*#__PURE__*/React.createElement(React.Fragment, null, children)); } } Animation.propTypes = propTypes; Animation.defaultProps = defaultProps; // if (__DOCS__) { // Animation.docs = { // componentGroup: 'Animation', // folderName: 'Style Guide', // external: true, // description: ' ' // }; // }