UNPKG

3.93 kBJavaScriptView Raw
1'use strict';
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6
7var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
8
9var _style = require('./style.css');
10
11var _style2 = _interopRequireDefault(_style);
12
13var _tableItem = require('../table-item');
14
15var _tableItem2 = _interopRequireDefault(_tableItem);
16
17var _icon = require('../icon');
18
19var Icons = _interopRequireWildcard(_icon);
20
21var _capitalize = require('lodash/capitalize');
22
23var _capitalize2 = _interopRequireDefault(_capitalize);
24
25var _react = require('react');
26
27var _react2 = _interopRequireDefault(_react);
28
29function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
30
31function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
32
33function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
34
35function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
36
37function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
38
39var NavigationColumn = function (_Component) {
40 _inherits(NavigationColumn, _Component);
41
42 function NavigationColumn() {
43 _classCallCheck(this, NavigationColumn);
44
45 return _possibleConstructorReturn(this, (NavigationColumn.__proto__ || Object.getPrototypeOf(NavigationColumn)).apply(this, arguments));
46 }
47
48 _createClass(NavigationColumn, [{
49 key: 'render',
50
51
52 /**
53 * Render the component.
54 *
55 * @return {ReactElement}
56 */
57 value: function render() {
58 var Icon = Icons['Arrow' + (0, _capitalize2.default)(this.props.direction)];
59
60 return _react2.default.createElement(
61 'tr',
62 { ref: 'component', className: _style2.default.column },
63 _react2.default.createElement(
64 'th',
65 { ref: 'header', className: _style2.default.navigation },
66 _react2.default.createElement(Icon, { height: 16, style: { opacity: this.props.visible ? '1' : '0' } })
67 ),
68 this.props.entries.map(function (entry) {
69 return _react2.default.createElement(
70 _tableItem2.default,
71 { key: entry.code, className: _style2.default.head_item },
72 '\xA0'
73 );
74 })
75 );
76 }
77
78 /**
79 * Define the proptypes of the component.
80 *
81 * @type {Object}
82 */
83
84 }]);
85
86 return NavigationColumn;
87}(_react.Component);
88
89NavigationColumn.propTypes = {
90 visible: _react.PropTypes.bool.isRequired,
91 entries: _react.PropTypes.array.isRequired,
92 direction: _react.PropTypes.oneOf(['left', 'right']).isRequired
93};
94exports.default = NavigationColumn;
\No newline at end of file