1 | 'use strict';
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 |
|
7 | var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
8 |
|
9 | var _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; }; }();
|
10 |
|
11 | var _templateObject = _taggedTemplateLiteral(['\n flex: 1;\n font-family: ', ';\n color: ', ';\n background: ', ';\n {...other}\n text-decoration: none;\n font-size: 1.25em;\n padding: 0.75em;\n text-align: center;\n transition: all 0.2s ease-in;\n border-radius: 3px;\n'], ['\n flex: 1;\n font-family: ', ';\n color: ', ';\n background: ', ';\n {...other}\n text-decoration: none;\n font-size: 1.25em;\n padding: 0.75em;\n text-align: center;\n transition: all 0.2s ease-in;\n border-radius: 3px;\n']);
|
12 |
|
13 | var _styledComponents = require('styled-components');
|
14 |
|
15 | var _styledComponents2 = _interopRequireDefault(_styledComponents);
|
16 |
|
17 | var _react = require('react');
|
18 |
|
19 | var _react2 = _interopRequireDefault(_react);
|
20 |
|
21 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
22 |
|
23 | function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
24 |
|
25 | function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
26 |
|
27 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
28 |
|
29 | function _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; }
|
30 |
|
31 | function _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; }
|
32 |
|
33 | var Tab = function (_Component) {
|
34 | _inherits(Tab, _Component);
|
35 |
|
36 | function Tab() {
|
37 | var _ref;
|
38 |
|
39 | var _temp, _this, _ret;
|
40 |
|
41 | _classCallCheck(this, Tab);
|
42 |
|
43 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
44 | args[_key] = arguments[_key];
|
45 | }
|
46 |
|
47 | return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = Tab.__proto__ || Object.getPrototypeOf(Tab)).call.apply(_ref, [this].concat(args))), _this), _this.onClick = function () {
|
48 | _this.context.onTabClick(_this.props.index);
|
49 | }, _temp), _possibleConstructorReturn(_this, _ret);
|
50 | }
|
51 |
|
52 | |
53 |
|
54 |
|
55 |
|
56 |
|
57 |
|
58 |
|
59 | _createClass(Tab, [{
|
60 | key: 'render',
|
61 |
|
62 |
|
63 | |
64 |
|
65 |
|
66 |
|
67 |
|
68 | value: function render() {
|
69 |
|
70 | var _props = this.props,
|
71 | children = _props.children,
|
72 | index = _props.index,
|
73 | active = _props.active,
|
74 | other = _objectWithoutProperties(_props, ['children', 'index', 'active']);
|
75 |
|
76 | return _react2.default.createElement(
|
77 | 'a',
|
78 | _extends({
|
79 | role: 'tab',
|
80 | onClick: this.onClick,
|
81 | 'aria-selected': false
|
82 | }, other),
|
83 | children
|
84 | );
|
85 | }
|
86 | }]);
|
87 |
|
88 | return Tab;
|
89 | }(_react.Component);
|
90 |
|
91 | Tab.propTypes = {
|
92 | index: _react.PropTypes.number,
|
93 | active: _react.PropTypes.bool,
|
94 | children: _react.PropTypes.node,
|
95 | className: _react.PropTypes.string
|
96 | };
|
97 | Tab.contextTypes = {
|
98 | onTabClick: _react.PropTypes.func.isRequired
|
99 | };
|
100 | exports.default = (0, _styledComponents2.default)(Tab)(_templateObject, function (props) {
|
101 | return props.theme.fontHeader;
|
102 | }, function (props) {
|
103 | return props.active ? props.theme.blank : props.dark ? props.theme.dark : props.theme.secondary;
|
104 | }, function (props) {
|
105 | return props.active ? props.dark ? props.theme.dark : props.theme.secondary : props.theme.blank;
|
106 | }); |
\ | No newline at end of file |