UNPKG

wix-storybook-utils

Version:

Utilities for automated component documentation within Storybook

37 lines 1.78 kB
import { __extends } from "tslib"; import React from 'react'; import classNames from 'classnames'; import PropTypes from 'prop-types'; import * as TabPropTypes from '../constants/tab-prop-types'; import TabItem from '../TabItem'; import withItemMaxWidth from '../withItemMaxWidth'; import styles from '../../styles.scss'; var TabItems = /** @class */ (function (_super) { __extends(TabItems, _super); function TabItems() { return _super !== null && _super.apply(this, arguments) || this; } TabItems.prototype.renderItem = function (item) { var _a = this.props, activeId = _a.activeId, type = _a.type, width = _a.width, onClick = _a.onClick, itemMaxWidth = _a.itemMaxWidth; return (React.createElement(TabItem, { key: item.id, dataHook: item.dataHook, item: item, itemMaxWidth: itemMaxWidth, isActive: activeId === item.id, type: type, width: width, onItemClick: onClick })); }; TabItems.prototype.render = function () { var _this = this; var _a = this.props, items = _a.items, type = _a.type, dataHook = _a.dataHook; var className = classNames(styles.itemsContainer, styles[type]); return (React.createElement("ul", { className: className, "data-hook": dataHook, style: { minWidth: this.props.minWidth } }, items.map(function (item) { return _this.renderItem(item); }))); }; return TabItems; }(React.Component)); TabItems.propTypes = { activeId: TabPropTypes.activeId, dataHook: PropTypes.string, itemMaxWidth: PropTypes.number, items: TabPropTypes.items.isRequired, minWidth: TabPropTypes.width, type: TabPropTypes.type, width: TabPropTypes.width, onClick: TabPropTypes.onClick, }; export default withItemMaxWidth(TabItems); //# sourceMappingURL=index.js.map