forked from nukeop/nuclear
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
64 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 32 additions & 29 deletions
61
packages/app/app/components/ArtistView/ArtistTags/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,38 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { withRouter } from 'react-router-dom'; | ||
import { compose, withHandlers } from 'recompose'; | ||
|
||
import styles from './styles.scss'; | ||
|
||
class ArtistTags extends React.Component { | ||
constructor(props) { | ||
super(props); | ||
} | ||
const ArtistTags = ({ | ||
tags, | ||
onTagClick | ||
}) => ( | ||
<div className={styles.tags_container}> | ||
{ | ||
tags && tags.length > 0 && | ||
tags.map((tag, i) => { | ||
return ( | ||
<a | ||
href='#' | ||
onClick={() => onTagClick(tag)} | ||
key={i} | ||
className={styles.tag} | ||
>#{tag}</a> | ||
); | ||
}) | ||
} | ||
</div> | ||
); | ||
|
||
onTagClick(tag) { | ||
this.props.history.push('/tag/' + tag); | ||
} | ||
ArtistTags.propTypes = { | ||
tags: PropTypes.arrayOf(PropTypes.string) | ||
}; | ||
|
||
render() { | ||
return ( | ||
<div className={styles.tags_container}> | ||
{ | ||
this.props.tags && this.props.tags.length > 0 && | ||
this.props.tags.map((el, i) => { | ||
return ( | ||
<a | ||
href='#' | ||
onClick={() => this.onTagClick.bind(this)(el.name)} | ||
key={i} | ||
className={styles.tag} | ||
>#{el.name}</a> | ||
); | ||
}) | ||
} | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
export default ArtistTags; | ||
export default compose( | ||
withRouter, | ||
withHandlers({ | ||
onTagClick: ({ history }) => tag => history.push(`/tag/${tag}`) | ||
}) | ||
)(ArtistTags); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters