|
| 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 React = require('react'); |
| 8 | +var react_redux_1 = require('react-redux'); |
| 9 | +var selectors_1 = require('../../../selectors'); |
| 10 | +var index_1 = require('../../index'); |
| 11 | +var HintButton_1 = require('./HintButton'); |
| 12 | +var Card_1 = require('material-ui/Card'); |
| 13 | +var help_1 = require('material-ui/svg-icons/action/help'); |
| 14 | +var actions_1 = require('../../../actions'); |
| 15 | +var selectors_2 = require('../../../selectors'); |
| 16 | +var styles = { |
| 17 | + position: 'relative', |
| 18 | + margin: '5px auto 10px', |
| 19 | + width: '360px', |
| 20 | + textAlign: 'center', |
| 21 | +}; |
| 22 | +var Hints = (function (_super) { |
| 23 | + __extends(Hints, _super); |
| 24 | + function Hints() { |
| 25 | + _super.apply(this, arguments); |
| 26 | + } |
| 27 | + Hints.prototype.render = function () { |
| 28 | + var _a = this.props, hint = _a.hint, hintPosition = _a.hintPosition, hintsLength = _a.hintsLength, hintPositionSet = _a.hintPositionSet; |
| 29 | + if (!hint) { |
| 30 | + return null; |
| 31 | + } |
| 32 | + return (React.createElement(Card_1.Card, {style: styles}, |
| 33 | + React.createElement(Card_1.CardHeader, {title: 'Hints', avatar: React.createElement(help_1.default, null), actAsExpander: true, showExpandableButton: true}), |
| 34 | + React.createElement(Card_1.CardText, {className: 'cr-task-hint', expandable: true}, |
| 35 | + React.createElement(index_1.Markdown, {children: hint}) |
| 36 | + ), |
| 37 | + React.createElement(Card_1.CardActions, {style: { paddingBottom: '30px !important' }, expandable: true, className: 'cr-task-hints-actions'}, |
| 38 | + React.createElement(HintButton_1.default, {type: 'prev', label: 'Previous', hintPosition: hintPosition, hintsLength: hintsLength, hintPositionSet: hintPositionSet}), |
| 39 | + React.createElement(HintButton_1.default, {type: 'next', label: 'Next', hintPosition: hintPosition, hintsLength: hintsLength, hintPositionSet: hintPositionSet})))); |
| 40 | + }; |
| 41 | + return Hints; |
| 42 | +}(React.Component)); |
| 43 | +var mapStateToProps = function (state) { return ({ |
| 44 | + hint: selectors_1.hintSelector(state), |
| 45 | + hintPosition: state.hintPosition, |
| 46 | + hintsLength: selectors_2.hintsSelector(state).length, |
| 47 | +}); }; |
| 48 | +var mapDispatchToProps = { hintPositionSet: actions_1.hintPositionSet }; |
| 49 | +Object.defineProperty(exports, "__esModule", { value: true }); |
| 50 | +exports.default = react_redux_1.connect(mapStateToProps, mapDispatchToProps)(Hints); |
0 commit comments