jakaria_hossain

rooms images

Dec 23rd, 2020
13
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import React, { Component } from "react";
  2. import { Link } from "react-router-dom";
  3. import { connect } from "react-redux";
  4. import { loadRooms } from "../store/actions/roomAction";
  5.  
  6. import single_basic from "../images/single-basic.jpeg";
  7. import single_standard from "../images/single-standard.jpeg";
  8. import single_economy from "../images/single-economy.jpeg";
  9. import single_deluxe from "../images/single-deluxe.jpeg";
  10. import double_deluxe from "../images/double-deluxe.jpeg";
  11. import double_basic from "../images/double-basic.jpeg";
  12. import double_economy from "../images/double-economy.jpeg";
  13. import double_standard from "../images/double-standard.jpeg";
  14. import family_standard from "../images/family-standard.jpeg";
  15. import family_basic from "../images/family-basic.jpeg";
  16. import family_economy from "../images/family-economy.jpeg";
  17. import family_deluxe from "../images/family-deluxe.jpeg";
  18. import presidential from "../images/presidential.jpeg";
  19.  
  20. class Room extends Component {
  21. componentDidMount() {
  22. this.props.loadRooms();
  23. }
  24. render() {
  25. let { rooms } = this.props;
  26. return rooms.map((room) => (
  27. <article className="room" key={room._id}>
  28. <div className="img-container">
  29. <img
  30. src={
  31. room.room_key === "single_basic"
  32. ? `${single_basic}`
  33. : room.room_key === "single_standard"
  34. ? `${single_standard}`
  35. : room.room_key === "single_economy"
  36. ? `${single_economy}`
  37. : room.room_key === "single_deluxe"
  38. ? `${single_deluxe}`
  39. : room.room_key === "double_basic"
  40. ? `${double_basic}`
  41. : room.room_key === "double_standard"
  42. ? `${double_standard}`
  43. : room.room_key === "double_economy"
  44. ? `${double_economy}`
  45. : room.room_key === "double_deluxe"
  46. ? `${double_deluxe}`
  47. : room.room_key === "family_basic"
  48. ? `${family_basic}`
  49. : room.room_key === "family_economy"
  50. ? `${family_economy}`
  51. : room.room_key === "family_standard"
  52. ? `${family_standard}`
  53. : room.room_key === "family_economy"
  54. ? `${family_economy}`
  55. : room.room_key === "family_deluxe"
  56. ? `${family_deluxe}`
  57. : `${presidential}`
  58. }
  59. alt={`${room.name}`}
  60. />
  61. <div className="price-top">
  62. <h6>BDT {room.price}</h6>
  63. <p>per night</p>
  64. </div>
  65. <Link
  66. to={`/rooms/${room.room_key}`}
  67. className="btn-primary room-link"
  68. >
  69. features
  70. </Link>
  71. </div>
  72. <p className="room-info">{room.name}</p>
  73. </article>
  74. ));
  75. }
  76. }
  77. const mapStateToProps = (state) => ({
  78. rooms: state.rooms,
  79. });
  80. export default connect(mapStateToProps, { loadRooms })(Room);
  81.  
RAW Paste Data