2020-08-17 21:07:16 +01:00
|
|
|
import React from 'react'
|
2020-08-17 21:59:29 +01:00
|
|
|
import PropTypes from 'prop-types'
|
2020-05-07 00:40:54 +01:00
|
|
|
import ResponsiveClassesComponent from '../features/ui/util/responsive_classes_component'
|
2020-04-29 23:32:49 +01:00
|
|
|
import PillItem from './pill_item'
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Renders pills components
|
|
|
|
* @param {array} [props.pills] - tab bar data for creating `TabBarItem`
|
|
|
|
*/
|
2020-08-18 01:57:35 +01:00
|
|
|
class Pills extends React.PureComponent {
|
2020-04-29 23:32:49 +01:00
|
|
|
|
|
|
|
render() {
|
|
|
|
const { pills } = this.props
|
|
|
|
|
|
|
|
return (
|
2020-05-07 00:40:54 +01:00
|
|
|
<ResponsiveClassesComponent
|
2020-08-18 21:49:11 +01:00
|
|
|
classNames={[_s.d, _s.flexWrap, _s.px5, _s.flexRow].join(' ')}
|
|
|
|
classNamesXS={[_s.d, _s.overflowYHidden, _s.overflowXScroll, _s.noScrollbar, _s.pl10, _s.pr15, _s.flexRow].join(' ')}
|
2020-05-07 00:40:54 +01:00
|
|
|
>
|
2020-04-29 23:32:49 +01:00
|
|
|
{
|
|
|
|
!!pills &&
|
|
|
|
pills.map((tab, i) => (
|
|
|
|
<PillItem
|
|
|
|
key={`pill-item-${i}`}
|
|
|
|
title={tab.title}
|
|
|
|
onClick={tab.onClick}
|
|
|
|
to={tab.to}
|
|
|
|
isActive={tab.active}
|
|
|
|
/>
|
|
|
|
))
|
|
|
|
}
|
2020-05-07 00:40:54 +01:00
|
|
|
</ResponsiveClassesComponent>
|
2020-04-29 23:32:49 +01:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2020-08-18 01:57:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
Pills.propTypes = {
|
|
|
|
pills: PropTypes.array,
|
|
|
|
}
|
|
|
|
|
|
|
|
export default Pills
|