UNPKG

feeles-ide

Version:

The hackable and serializable IDE to make learning material

88 lines (73 loc) 2.59 kB
import _Object$getPrototypeOf from 'babel-runtime/core-js/object/get-prototype-of'; import _classCallCheck from 'babel-runtime/helpers/classCallCheck'; import _createClass from 'babel-runtime/helpers/createClass'; import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn'; import _inherits from 'babel-runtime/helpers/inherits'; import React, { Component } from 'react'; import PropTypes from 'prop-types'; import Dialog from 'material-ui/Dialog'; import AlertError from 'material-ui/svg-icons/alert/error'; import { redA400 } from 'material-ui/styles/colors'; import { Confirm, Abort } from './Buttons'; var DeleteDialog = function (_Component) { _inherits(DeleteDialog, _Component); function DeleteDialog(props) { _classCallCheck(this, DeleteDialog); var _this = _possibleConstructorReturn(this, (DeleteDialog.__proto__ || _Object$getPrototypeOf(DeleteDialog)).call(this, props)); _this.handleDelete = function () { var _this$props = _this.props, resolve = _this$props.resolve, onRequestClose = _this$props.onRequestClose, content = _this$props.content; resolve(content); onRequestClose(); }; return _this; } _createClass(DeleteDialog, [{ key: 'render', value: function render() { var _props = this.props, onRequestClose = _props.onRequestClose, content = _props.content; var style = { textAlign: 'center' }; var iconStyle = { marginRight: 10, marginBottom: -6 }; var actions = [React.createElement(Abort, { key: 'close', onClick: onRequestClose }), React.createElement(Confirm, { key: 'delete', label: 'Delete', onClick: this.handleDelete })]; return React.createElement( Dialog, { title: React.createElement( 'h3', null, 'Do you really want to delete ', React.createElement( 'b', null, content && content.name ), '?' ), actions: actions, modal: false, open: true, onRequestClose: onRequestClose, bodyStyle: style }, React.createElement(AlertError, { color: redA400, style: iconStyle }), 'This operation can not be undone.' ); } }]); return DeleteDialog; }(Component); DeleteDialog.propTypes = { resolve: PropTypes.func.isRequired, onRequestClose: PropTypes.func.isRequired, content: PropTypes.any }; export default DeleteDialog;