BOOM removed helper bar view look at those stats brah

This commit is contained in:
Peter Cottle 2015-04-20 15:31:30 +10:00
parent 4fd4fc93fe
commit ce5fc82ca9
7 changed files with 305 additions and 286 deletions

View file

@ -0,0 +1,64 @@
var React = require('react');
var reactUtil = require('../util/reactUtil');
var HelperBarView = React.createClass({
propTypes: {
className: React.PropTypes.string,
shown: React.PropTypes.bool.isRequired,
items: React.PropTypes.array.isRequired
},
render: function() {
var topClassName = reactUtil.joinClasses([
'helperBar',
'transitionAll',
this.props.shown ? 'show' : '',
this.props.className ? this.props.className : ''
]);
return (
<div className={topClassName}>
{this.props.items.map(function(item, index) {
return [
this.renderItem(item),
// ugh -- we need this spacer at the end only
// if we are not the last element
index === this.props.items.length - 1 ?
null :
<span key={'helper_bar_' + index}>{' '}</span>
];
}.bind(this))}
</div>
);
},
renderItem: function(item, index) {
if (item.newPageLink) {
return (
<a
key={'helper_bar_' + index}
onClick={item.onClick}
target="_blank"
href={item.href}>
<i className={'icon-' + item.icon} />
{' '}
</a>
);
}
return (
<a
key={'helper_bar_' + index}
onClick={item.onClick}>
{item.text ? item.text :
<i className={'icon-' + item.icon} />
}
{' '}
</a>
);
}
});
module.exports = HelperBarView;