AvatarStub.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import React from "react";
  2. // const r = () => Math.floor(Math.random() * 256);
  3. // const g = () => Math.floor(Math.random() * 256);
  4. // const b = () => Math.floor(Math.random() * 256);
  5. // export const color = () => {
  6. // return "#" + r().toString(16) + g().toString(16) + b().toString(16);
  7. // };
  8. export const AvatarStub = (props) => {
  9. return (
  10. <div className="stubAvatar" >
  11. <p className="chatAvatarText">
  12. {props?.login
  13. .split(" ", 2)
  14. .map(function (item) {
  15. return item[0];
  16. })
  17. .join("")}
  18. </p>
  19. </div>
  20. );
  21. };
  22. export const AvatarStubHeader = (props) => {
  23. return (
  24. <div
  25. className="stubAvatarHeader"
  26. >
  27. <p className="chatAvatarTextHeader">
  28. {props?.login === undefined ? " " :
  29. props?.login.split(" ", 2)
  30. .map(function (item) {
  31. return item[0];
  32. })
  33. .join("")}
  34. </p>
  35. </div>
  36. );
  37. };