AnimTableBody.js 952 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. import React from 'react';
  2. import PropTypes from 'prop-types';
  3. import { TweenOneGroup } from 'rc-tween-one';
  4. const enterAnim = [
  5. {
  6. opacity: 0,
  7. x: 30,
  8. backgroundColor: '#fffeee',
  9. duration: 0,
  10. }, {
  11. height: 0,
  12. duration: 200,
  13. type: 'from',
  14. delay: 250,
  15. ease: 'easeOutQuad',
  16. onComplete: (e) => {
  17. e.target.style.height = 'auto';
  18. },
  19. }, {
  20. opacity: 1,
  21. x: 0,
  22. duration: 250,
  23. ease: 'easeOutQuad',
  24. }, {
  25. delay: 1000,
  26. backgroundColor: '#fff',
  27. },
  28. ];
  29. const leaveAnim = [
  30. {
  31. duration: 250,
  32. x: -30,
  33. opacity: 0,
  34. }, {
  35. height: 0,
  36. duration: 200,
  37. ease: 'easeOutQuad',
  38. },
  39. ];
  40. const AnimTableBody = ({ className, children }) => {
  41. return (
  42. <TweenOneGroup
  43. component="tbody"
  44. className={className}
  45. enter={enterAnim}
  46. leave={leaveAnim}
  47. appear={false}
  48. >
  49. {children}
  50. </TweenOneGroup>
  51. );
  52. };
  53. export default AnimTableBody;