|
| 1 | +"use strict"; |
| 2 | +var __extends = (this && this.__extends) || function (d, b) { |
| 3 | + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; |
| 4 | + function __() { this.constructor = d; } |
| 5 | + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); |
| 6 | +}; |
| 7 | +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { |
| 8 | + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; |
| 9 | + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); |
| 10 | + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; |
| 11 | + return c > 3 && r && Object.defineProperty(target, key, r), r; |
| 12 | +}; |
| 13 | +var __metadata = (this && this.__metadata) || function (k, v) { |
| 14 | + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); |
| 15 | +}; |
| 16 | +var React = require('react'); |
| 17 | +var react_redux_1 = require('react-redux'); |
| 18 | +var Snackbar_1 = require('material-ui/Snackbar'); |
| 19 | +var actions_1 = require('./actions'); |
| 20 | +var defaultAlert = { |
| 21 | + message: '', |
| 22 | + open: false, |
| 23 | +}; |
| 24 | +var styles = { |
| 25 | + display: 'inline-block', |
| 26 | + margin: '0px 10px', |
| 27 | +}; |
| 28 | +var Alert = (function (_super) { |
| 29 | + __extends(Alert, _super); |
| 30 | + function Alert() { |
| 31 | + _super.apply(this, arguments); |
| 32 | + } |
| 33 | + Alert.prototype.render = function () { |
| 34 | + var _a = this.props, alert = _a.alert, close = _a.close; |
| 35 | + var action = alert.action, message = alert.message, open = alert.open, duration = alert.duration, color = alert.color; |
| 36 | + return (React.createElement(Snackbar_1.default, {style: styles, bodyStyle: { color: color }, open: open, message: message || '', action: action || '', autoHideDuration: duration || 2000, onRequestClose: close})); |
| 37 | + }; |
| 38 | + Alert = __decorate([ |
| 39 | + react_redux_1.connect(null, function (dispatch) { |
| 40 | + return { |
| 41 | + close: function () { return dispatch(actions_1.alertClose()); } |
| 42 | + }; |
| 43 | + }), |
| 44 | + __metadata('design:paramtypes', []) |
| 45 | + ], Alert); |
| 46 | + return Alert; |
| 47 | +}(React.Component)); |
| 48 | +Object.defineProperty(exports, "__esModule", { value: true }); |
| 49 | +exports.default = Alert; |
0 commit comments