UNPKG

1.69 kBJavaScriptView Raw
1'use strict';
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6
7var _templateObject = _taggedTemplateLiteral(['\n display: flex;\n margin: 0 auto;\n justify-content: center;\n background: ', ';\n border: 1px solid ', ';\n border-radius: 3px;\n box-shadow: 0px 2px 0px 0px rgba(0,0,0,0.10);\n padding: 2px;\n'], ['\n display: flex;\n margin: 0 auto;\n justify-content: center;\n background: ', ';\n border: 1px solid ', ';\n border-radius: 3px;\n box-shadow: 0px 2px 0px 0px rgba(0,0,0,0.10);\n padding: 2px;\n']);
8
9var _styledComponents = require('styled-components');
10
11var _styledComponents2 = _interopRequireDefault(_styledComponents);
12
13var _react = require('react');
14
15var _react2 = _interopRequireDefault(_react);
16
17function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
19function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
20
21var Container = _styledComponents2.default.nav(_templateObject, function (props) {
22 return props.theme.background;
23}, function (props) {
24 return props.theme.light;
25});
26
27var TabList = function TabList(_ref, context) {
28 var children = _ref.children;
29 return _react2.default.createElement(
30 Container,
31 null,
32 _react.Children.map(children, function (child, key) {
33 return (0, _react.cloneElement)(child, {
34 key: key,
35 index: key,
36 active: key === context.currentTab
37 });
38 })
39 );
40};
41
42TabList.propTypes = {
43 children: _react.PropTypes.node.isRequired
44};
45
46TabList.contextTypes = {
47 currentTab: _react.PropTypes.number
48};
49
50exports.default = TabList;
\No newline at end of file