var React = require('react');
var PropTypes = require('prop-types');
var reactUtil = require('../util/reactUtil');
class HelperBarView extends React.Component {
render() {
var topClassName = reactUtil.joinClasses([
'helperBar',
'transitionAll',
this.props.shown ? 'show' : '',
this.props.className ? this.props.className : ''
]);
return (
{this.props.items.map(function(item, index) {
return [
this.renderItem(item, index),
// ugh -- we need this spacer at the end only
// if we are not the last element
index === this.props.items.length - 1 ?
null :
{' '}
];
}.bind(this))}
);
}
renderItem(item, index) {
var testID = item.icon || item.testID ||
item.text.toLowerCase();
if (item.newPageLink) {
return (
{' '}
);
}
return (
{item.text ? item.text :
}
{' '}
);
}
};
HelperBarView.propTypes = {
className: PropTypes.string,
shown: PropTypes.bool.isRequired,
items: PropTypes.array.isRequired
};
module.exports = HelperBarView;