UNPKG

wix-style-react

Version:
28 lines 1.37 kB
import React from 'react'; import PropTypes from 'prop-types'; import * as TabPropTypes from '../constants/tab-prop-types'; import TabItem from '../TabItem'; import withItemMaxWidth from '../withItemMaxWidth'; import { st, classes } from '../../Tabs.st.css'; class TabItems extends React.Component { renderItem(item) { const { activeId, type, width, onClick, itemMaxWidth, alignment, size } = this.props; return (React.createElement(TabItem, { key: item.id, dataHook: item.dataHook, item: item, itemMaxWidth: itemMaxWidth, alignment: alignment, isActive: activeId === item.id, type: type, width: width, onItemClick: onClick, size: size })); } render() { const { items, type, dataHook } = this.props; return (React.createElement("div", { role: "tablist", "data-type": type, "data-hook": dataHook, className: st(classes.itemsContainer, classes[type]), style: { minWidth: this.props.minWidth } }, items.map(item => this.renderItem(item)))); } } 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