Advertisement
Guest User

Untitled

a guest
Sep 1st, 2016
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. var Photo = React.createClass({
  2. getTagDetail: function (tag){
  3. return (
  4. <li>{tag.name} ({tag.taglevel})</li>
  5. );
  6. },
  7.  
  8. sortTags: function (tagA, tagB) {
  9. return tagA.taglevel - tagB.taglevel;
  10. },
  11.  
  12. render: function(){
  13. return (
  14. <ListGroup data-title={this.props.title}>
  15. <ListGroupItem key={this.props.id}>{this.props.title}</ListGroupItem>
  16. <ListGroupItem key={this.props.title}>{this.props.tags.sort(this.sortTags).map(this.getTagDetail)}</ListGroupItem>
  17. </ListGroup>
  18. );
  19. }
  20. })
  21.  
  22. var PhotoGalleryButton = React.createClass({
  23. getInitialState: function() {
  24. return this.state = {
  25. isClicked: false
  26. }
  27. },
  28. onClick: function (e) {
  29. this.setState({
  30. isClicked: !this.state.isClicked
  31. })
  32. this.props.selectTag(this.props.tag);
  33. },
  34. render: function () {
  35. return (
  36. <a className={this.state.isClicked ? 'filter-panel-1' : ''} onClick={this.onClick}>{this.props.tag.name}</a>
  37. );
  38. }
  39. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement