wix-storybook-utils
Version:
Utilities for automated component documentation within Storybook
31 lines • 1.4 kB
JavaScript
import { __assign, __extends } from "tslib";
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import pick from 'lodash/pick';
import * as TabPropTypes from '../constants/tab-prop-types';
import styles from '../../styles.scss';
var TabItem = /** @class */ (function (_super) {
__extends(TabItem, _super);
function TabItem() {
return _super !== null && _super.apply(this, arguments) || this;
}
TabItem.prototype.render = function () {
var _a;
var _b = this.props, item = _b.item, onItemClick = _b.onItemClick, isActive = _b.isActive, dynamicProperties = _b.dynamicProperties, dataHook = _b.dataHook;
var containerProps = __assign({ key: item.id, onClick: function () { return onItemClick(item); }, className: classNames(styles.tab, (_a = {}, _a[styles.active] = isActive, _a)) }, pick(this.props, dynamicProperties));
return (React.createElement("li", __assign({ "data-hook": dataHook }, containerProps), item.title));
};
return TabItem;
}(React.Component));
TabItem.propTypes = {
itemMaxWidth: PropTypes.number,
isActive: PropTypes.bool,
item: TabPropTypes.item.isRequired,
onItemClick: TabPropTypes.onClick,
type: TabPropTypes.type,
width: TabPropTypes.width,
dynamicProperties: PropTypes.array,
};
export default TabItem;
//# sourceMappingURL=index.js.map