2016-10-26 16:55:47 +13:00
|
|
|
|
2017-08-09 08:52:49 +12:00
|
|
|
import { hashHistory } from 'react-router'
|
|
|
|
|
|
2016-10-26 16:55:47 +13:00
|
|
|
import React, { PropTypes } from 'react'
|
|
|
|
|
import GridItem from './GridItem'
|
|
|
|
|
|
|
|
|
|
export default class CategoryGrid extends React.Component{
|
|
|
|
|
|
2017-10-10 13:05:28 +13:00
|
|
|
constructor(props){
|
2016-10-26 16:55:47 +13:00
|
|
|
super(props);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
render(){
|
2017-10-10 13:05:28 +13:00
|
|
|
if (!this.props.categories ) return null
|
2016-11-08 13:36:13 +13:00
|
|
|
|
|
|
|
|
var className = "grid category-grid"
|
2017-10-10 13:05:28 +13:00
|
|
|
if (this.props.className ) className += ' '+this.props.className
|
2016-11-08 13:36:13 +13:00
|
|
|
return (
|
|
|
|
|
<div className={className}>
|
|
|
|
|
{
|
2017-08-09 08:52:49 +12:00
|
|
|
this.props.categories.map(category => {
|
|
|
|
|
return (
|
|
|
|
|
<GridItem
|
|
|
|
|
key={category.id}
|
|
|
|
|
type="category"
|
|
|
|
|
item={category}
|
2017-10-27 10:51:48 +13:00
|
|
|
onClick={e => {hashHistory.push(global.baseURL+'discover/categories/'+encodeURIComponent(category.id))}}
|
2017-08-09 08:52:49 +12:00
|
|
|
/>
|
|
|
|
|
)
|
|
|
|
|
})
|
2016-11-08 13:36:13 +13:00
|
|
|
}
|
|
|
|
|
</div>
|
|
|
|
|
);
|
2016-10-26 16:55:47 +13:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|