()
| 59 | } |
| 60 | |
| 61 | render() { |
| 62 | const { visible } = this.state |
| 63 | const { onClose = () => false, willUnmount, duration, top, type, iconClass, title, message } = this.props |
| 64 | return ( |
| 65 | <Transition |
| 66 | unmountOnExit |
| 67 | transitionClass={{ |
| 68 | exiting: 'el-notification-fade-leave-active', |
| 69 | exited: 'el-notification-fade-enter' |
| 70 | }} |
| 71 | in={visible} |
| 72 | onEnter={() => { |
| 73 | this.offsetHeight = this.rootDOM.offsetHeight; |
| 74 | }} |
| 75 | onExit={() => willUnmount(this.offsetHeight, parseInt(this.rootDOM.style.top))} |
| 76 | onExited={() => onClose()} |
| 77 | > |
| 78 | <View show={visible}> |
| 79 | <div |
| 80 | ref={(ele) => { this.rootDOM = ele; }} |
| 81 | className="el-notification" |
| 82 | style={{ |
| 83 | top, |
| 84 | zIndex: 9999 |
| 85 | }} |
| 86 | onMouseEnter={this.stopTimer.bind(this)} |
| 87 | onMouseLeave={this.startTimer.bind(this)} |
| 88 | onClick={this.onClick.bind(this)} |
| 89 | > |
| 90 | { |
| 91 | type && ( |
| 92 | <i className={this.classNames('el-notification__icon', this.typeClass(), iconClass)} /> |
| 93 | ) |
| 94 | } |
| 95 | <div |
| 96 | className={ |
| 97 | this.classNames('el-notification__group', { |
| 98 | 'is-with-icon': this.typeClass() || iconClass |
| 99 | }) |
| 100 | } |
| 101 | > |
| 102 | <h2 className="el-notification__title">{title}</h2> |
| 103 | <div className="el-notification__content">{message}</div> |
| 104 | <div className="el-notification__closeBtn el-icon-close" onClick={this.onClose.bind(this)} /> |
| 105 | </div> |
| 106 | </div> |
| 107 | </View> |
| 108 | </Transition> |
| 109 | ) |
| 110 | } |
| 111 | } |
| 112 | |
| 113 | Notification.propTypes = { |
no test coverage detected