Guest User

Untitled

a guest
Dec 13th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1. import React, { Component } from 'react';
  2. import './style.css'
  3.  
  4. class Weather extends Component {
  5. render() {
  6. return (
  7. <div>
  8. <ul className="list-group">
  9.  
  10. {
  11. this.props.country && this.props.city && <p>
  12. Location:
  13. <li className="list-group-item">
  14. {" "}
  15. {this.props.city} {this.props.country}
  16. </li>
  17. </p>
  18. }
  19. {
  20. this.props.lat && this.props.lon && <p>
  21. Latitude/Longitude:
  22. <li className="list-group-item">
  23. {" "}
  24. {this.props.lat}, {this.props.lon}
  25. </li>
  26. </p>
  27. }
  28. {
  29. this.props.temperature && <p>
  30. Temperature:
  31. <li className="list-group-item"> {Math.round(((this.props.temperature) - 273.15) * 10) / 10}° C</li>
  32. </p>
  33. }
  34. {
  35. this.props.humidity && <p>
  36. Humidity:
  37. <li className="list-group-item"> {this.props.humidity}%</li>
  38. </p>
  39. }
  40. {
  41. this.props.pressure && <p>
  42. Air pressure:
  43. <li className="list-group-item"> {Math.round(((this.props.pressure * 0.750062) / 25.4) * 100) / 100} mmHg</li>
  44. </p>
  45. }
  46. {
  47. this.props.clouds && <p>
  48. Clouds:
  49. <li className="list-group-item"> {this.props.clouds}% coverage</li>
  50. </p>
  51. }
  52. {
  53. this.props.wind && <p>
  54. Wind:
  55. <li className="list-group-item">
  56. {" "}
  57. {this.props.wind} MPH
  58. </li>
  59. </p>
  60. }
  61. {
  62. this.props.description && <p>
  63. Conditions:
  64. <li className="list-group-item"> {this.props.description}</li>
  65. </p>
  66. }
  67. {
  68. this.props.error && <p>{this.props.error}</p>
  69. }
  70. </ul>
  71. </div>
  72. );
  73. }
  74. }
  75.  
  76. export default Weather;
Add Comment
Please, Sign In to add comment