mirror of
https://github.com/zoriya/flood.git
synced 2025-12-19 21:55:15 +00:00
43 lines
728 B
JavaScript
43 lines
728 B
JavaScript
import React from 'react';
|
|
|
|
import AddTorrent from './AddTorrent';
|
|
import Icon from '../icons/Icon';
|
|
import UIActions from '../../actions/UIActions';
|
|
|
|
export default class Modal extends React.Component {
|
|
|
|
constructor() {
|
|
super();
|
|
}
|
|
|
|
handleModalClick(event) {
|
|
event.stopPropagation();
|
|
}
|
|
|
|
handleOverlayClick() {
|
|
UIActions.dismissModals();
|
|
}
|
|
|
|
render() {
|
|
let modal = null;
|
|
|
|
switch (this.props.type) {
|
|
case 'torrent-add':
|
|
modal = <AddTorrent clickHandler={this._onModalClick} />;
|
|
break;
|
|
}
|
|
|
|
if (modal) {
|
|
return (
|
|
<div className="modal" onClick={this._onOverlayClick}>
|
|
{modal}
|
|
</div>
|
|
);
|
|
} else {
|
|
return null;
|
|
}
|
|
|
|
}
|
|
|
|
}
|