FadeIn.js 668 B

1234567891011121314151617181920212223242526272829
  1. const { h, Component, createRef } = require('preact')
  2. const TRANSITION_MS = 300
  3. module.exports = class FadeIn extends Component {
  4. ref = createRef();
  5. componentWillEnter (callback) {
  6. this.ref.current.style.opacity = '1'
  7. this.ref.current.style.transform = 'none'
  8. setTimeout(callback, TRANSITION_MS)
  9. }
  10. componentWillLeave (callback) {
  11. this.ref.current.style.opacity = '0'
  12. this.ref.current.style.transform = 'translateY(350%)'
  13. setTimeout(callback, TRANSITION_MS)
  14. }
  15. render () {
  16. const { children } = this.props
  17. return (
  18. <div className="uppy-Informer-animated" ref={this.ref}>
  19. {children}
  20. </div>
  21. )
  22. }
  23. }