Artist list in lists

This commit is contained in:
James Barnsley
2016-11-21 16:54:17 +13:00
parent 6588790476
commit e3003a65db
2 changed files with 12 additions and 4 deletions

View File

@ -6,7 +6,7 @@ import Thumbnail from './Thumbnail'
export default class ArtistList extends React.Component{
constructor(props) {
super(props);
super(props)
}
render(){

View File

@ -1,6 +1,6 @@
import React, { PropTypes } from 'react'
import { Link } from 'react-router'
import { Link, browserHistory } from 'react-router'
import FontAwesome from 'react-fontawesome'
import ArtistSentence from './ArtistSentence'
@ -13,6 +13,14 @@ export default class List extends React.Component{
super(props);
}
handleClick(e, uri){
// make sure we haven't clicked a nested link (ie Artist name)
if( e.target.tagName.toLowerCase() !== 'a' ){
browserHistory.push( this.props.link_prefix + encodeURIComponent(uri) );
}
}
renderHeader(){
if( !this.props.columns ) return null
@ -54,7 +62,7 @@ export default class List extends React.Component{
{
this.props.rows.map( (row, row_index) => {
return (
<Link to={ this.props.link_prefix + encodeURIComponent(row.uri)} className="list-item cf" key={row_index}>
<div onClick={ e => this.handleClick(e, row.uri)} className="list-item cf" key={row_index}>
{
this.props.columns.map( (col, col_index) => {
return (
@ -65,7 +73,7 @@ export default class List extends React.Component{
})
}
{ this.props.show_source_icon ? <FontAwesome className="source" name={helpers.sourceIcon(row.uri)} /> : null }
</Link>
</div>
)
})
}