UNPKG

@uppy/informer

Version:

A notification and error pop-up bar for Uppy.

27 lines 714 B
import { h, Component, createRef } from 'preact'; const TRANSITION_MS = 300; export default class FadeIn extends Component { constructor() { super(...arguments); this.ref = createRef(); } componentWillEnter(callback) { this.ref.current.style.opacity = '1'; this.ref.current.style.transform = 'none'; setTimeout(callback, TRANSITION_MS); } componentWillLeave(callback) { this.ref.current.style.opacity = '0'; this.ref.current.style.transform = 'translateY(350%)'; setTimeout(callback, TRANSITION_MS); } render() { const { children } = this.props; return h("div", { className: "uppy-Informer-animated", ref: this.ref }, children); } }