MoreInfo.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. import React from 'react';
  2. import {Link} from 'react-router-dom'
  3. export default class MoreInfo extends React.Component {
  4. render() {
  5. const {his,data} = this.props;
  6. const doctor = data.find(el => el._id === his.match.params.doctor);
  7. const service = data.find(el => el._id === his.match.params.service);
  8. console.log (this.props, doctor)
  9. return (
  10. <main className = "main">
  11. {doctor && <div className= "wrapper">
  12. <h2>{doctor.name}</h2>
  13. <p>Duration:{doctor.profession}</p>
  14. <p>{doctor.description}</p>
  15. <p>Price:{doctor.experience}грн.</p>
  16. <Link to={`/doctors/${doctor}`}>Make an appointment</Link>
  17. </div>}
  18. {
  19. service && <div style={{display:'flex',flexDirection:'column', width:'200px', margin:'100px 20px'}}>
  20. {service.name}
  21. <p>Duration:{service.duration}h</p>
  22. <p>{service.description}</p>
  23. <p>Price:{service.price}грн.</p>
  24. <Link to={`/appointment/${service}`}>Make an appointment</Link>
  25. </div>
  26. }
  27. </main>
  28. );
  29. }
  30. }