mirror of
https://github.com/mickael-kerjean/filestash.git
synced 2025-10-30 01:26:43 +08:00
43 lines
968 B
JavaScript
43 lines
968 B
JavaScript
import React from 'react';
|
|
import PropTypes from 'prop-types';
|
|
|
|
import { Input, Button, Modal, NgIf } from './';
|
|
import { alert } from '../helpers/';
|
|
import { Popup } from './popup';
|
|
|
|
export class ModalAlert extends Popup {
|
|
constructor(props){
|
|
super(props);
|
|
}
|
|
|
|
componentDidMount(){
|
|
alert.subscribe((Component, okCallback) => {
|
|
this.setState({
|
|
appear: true,
|
|
value: Component,
|
|
fn: okCallback
|
|
});
|
|
});
|
|
}
|
|
|
|
onSubmit(e){
|
|
this.setState({appear: false}, () => {
|
|
requestAnimationFrame(() => this.state.fn())
|
|
});
|
|
}
|
|
|
|
modalContentBody(){
|
|
return (
|
|
<div className="modal-message">
|
|
{this.state.value}
|
|
</div>
|
|
);
|
|
}
|
|
|
|
modalContentFooter(){
|
|
return (
|
|
<Button type="submit" theme="emphasis" onClick={this.onSubmit.bind(this)}>OK</Button>
|
|
);
|
|
}
|
|
}
|