Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

UserReviewsCard.js 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. import React from "react";
  2. import PropTypes from "prop-types";
  3. import { ReviewList, ReviewsBox, ThumbDown, ThumbUp } from "./UserReviewsCard.styled";
  4. import {
  5. Avatar,
  6. Grid,
  7. ListItem,
  8. ListItemAvatar,
  9. Typography,
  10. Divider,
  11. } from "@mui/material";
  12. import Mockupdata from "./Mockupdata";
  13. import StarBorderIcon from "@mui/icons-material/StarBorder";
  14. import selectedTheme from "../../themes";
  15. import { useSelector } from "react-redux";
  16. import { selectOffer } from "../../store/selectors/offersSelectors";
  17. const UserReviewsCard = (props) => {
  18. var dataMockupdata = JSON.parse(JSON.stringify(Mockupdata));
  19. const offer = useSelector(selectOffer);
  20. console.log("user reviews: ", offer);
  21. return (
  22. <>
  23. <ReviewsBox>
  24. <Grid
  25. container
  26. direction="row"
  27. justifyContent="start"
  28. alignItems="center"
  29. sx={{ mb: 1.4 }}
  30. >
  31. <StarBorderIcon color="action" sx={{ mr: 0.9 }} />
  32. <Typography>{props.heading}</Typography>
  33. </Grid>
  34. <ReviewList>
  35. {offer?.companyData?.lastThreeReviews?.map((review) => (
  36. <>
  37. <ListItem
  38. alignItems="flex-start"
  39. sx={{ alignItems: "center", mt: 2 }}
  40. >
  41. <ListItemAvatar sx={{ mt: 0 }}>
  42. <Avatar alt={review.name} src="/static/images/avatar/1.jpg" />
  43. </ListItemAvatar>
  44. <Typography sx={{ color: selectedTheme.primaryPurple }}>
  45. <b>{review.name}</b>
  46. </Typography>
  47. </ListItem>
  48. <Grid
  49. container
  50. direction="row"
  51. justifyContent="start"
  52. alignItems="center"
  53. spacing={2}
  54. sx={{ pl: 2, py: 2 }}
  55. >
  56. <Grid item xs={1}>
  57. {review.isGood ? (
  58. <ThumbUp color="success" />
  59. ) : (
  60. <ThumbDown color="error" />
  61. )}
  62. </Grid>
  63. <Grid item xs={11}>
  64. <Typography
  65. sx={{ display: "inline" }}
  66. component="span"
  67. variant="body2"
  68. color="text.primary"
  69. >
  70. &quot;{review?.quote}&quot;
  71. </Typography>
  72. </Grid>
  73. </Grid>
  74. <Grid sx={{ pl: 2, pb: 2 }}>
  75. <Typography variant="body2" sx={{ display: "block" }}>
  76. Korektna komunikacija: <b>{review.isGoodCommunication}</b>
  77. </Typography>
  78. <Typography variant="body2" sx={{ display: "block" }}>
  79. Uspešna trampa: <b>{review.isSuccessfulSwap}</b>
  80. </Typography>
  81. </Grid>
  82. {review.id < dataMockupdata.length - 1 ? (
  83. <Divider variant="inset" component="li" sx={{ ml: 0 }} />
  84. ) : (
  85. <></>
  86. )}
  87. </>
  88. ))}
  89. </ReviewList>
  90. </ReviewsBox>
  91. </>
  92. );
  93. };
  94. UserReviewsCard.propTypes = {
  95. children: PropTypes.node,
  96. heading: PropTypes.string,
  97. };
  98. export default UserReviewsCard;