mirror of
				https://github.com/mickael-kerjean/filestash.git
				synced 2025-10-31 18:16:00 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			43 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			43 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| import React from 'react';
 | |
| import PropTypes from 'prop-types';
 | |
| import { Modal } from './';
 | |
| 
 | |
| import './popup.scss';
 | |
| 
 | |
| export class Popup extends React.Component {
 | |
|     constructor(props){
 | |
|         super(props);
 | |
|         if(new.target === Popup){
 | |
|             throw new TypeError("Cannot construct Popup instances directly");
 | |
|         }
 | |
|         this.state = {
 | |
|             appear: false
 | |
|         };
 | |
|     }
 | |
| 
 | |
|     onSubmit(e){
 | |
|         e && e.preventDefault && e.preventDefault();
 | |
|         this.setState({appear: false});
 | |
|     }
 | |
| 
 | |
|     onCancel(){
 | |
|         this.setState({appear: false});
 | |
|     }
 | |
| 
 | |
| 
 | |
|     render() {
 | |
|         return (
 | |
|             <Modal isActive={this.state.appear} onQuit={this.onCancel.bind(this)}>
 | |
|               <div className="component_popup">
 | |
|                 <div className="popup--content">
 | |
|                   { this.modalContentBody() }
 | |
|                 </div>
 | |
|                 <div className="buttons">
 | |
|                   { this.modalContentFooter() }
 | |
|                 </div>
 | |
|               </div>
 | |
|             </Modal>
 | |
|         );
 | |
|     }
 | |
| }
 | 
