Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2019
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.87 KB | None | 0 0
  1. {/* Match Card DEFINITION */}
  2. class SH_MatchCard extends React.Component{
  3. constructor(props){
  4. super(props);
  5. /* Won't take it because probably will be empty */
  6. this.state = {avatar: "", username: "", profile:{}}
  7. }
  8.  
  9. componentDidUpdate(prevProps){
  10. if(prevProps !== this.props){
  11. if(this.props.profile != undefined){
  12. this.setState({
  13. avatar: "/static/usrimg/" + this.props.profile.user_profile.picture,
  14. username: this.props.profile.username,
  15. profile: this.props.profile.user_profile
  16. });
  17. }
  18. }
  19. }
  20.  
  21. render(){
  22. if(!jQuery.isEmptyObject(this.state.profile)){
  23. return (
  24. <div className="searchCard">
  25. {/* Render avatar */}
  26. <div className="currentTheirAvatar">
  27. <img src={this.state.avatar} />
  28. </div>
  29.  
  30. <div className="container">
  31. <h3>{this.state.username}</h3>
  32. <div className="row">
  33. <div className="col-md-2">
  34.  
  35. </div>
  36. <div className="col-s-2">
  37. <GenderProp gender={this.state.profile.body.gender} />
  38. </div>
  39.  
  40. <div className="col-s-2">
  41. <BodyProp body={this.state.profile.body.body} />
  42. </div>
  43.  
  44. <div className="col-s-2">
  45. <AgeProp dob={this.state.profile.body.dob} />
  46. </div>
  47.  
  48. <div className="col-md-2">
  49.  
  50. </div>
  51. </div>
  52.  
  53. <div className="about">
  54. {this.state.profile.about[0].aboutme}
  55. </div>
  56.  
  57. </div>
  58.  
  59. </div>
  60. );
  61. }else{
  62. return "Processing...";
  63. }
  64. }
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement