UserInfo.tsx 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import React, { type JSX } from 'react';
  2. import type { IUserHasId } from '@growi/core';
  3. import { UserPicture } from '@growi/ui/dist/components';
  4. import styles from './UserInfo.module.scss';
  5. export type UserInfoProps = {
  6. author?: IUserHasId;
  7. };
  8. export const UserInfo = (props: UserInfoProps): JSX.Element => {
  9. const { author } = props;
  10. if (author == null || author.status === 4) {
  11. return <></>;
  12. }
  13. return (
  14. <div
  15. className={`${styles['grw-users-info']} grw-users-info d-flex align-items-center d-edit-none mb-5 pb-3 border-bottom`}
  16. data-testid="grw-users-info"
  17. >
  18. <UserPicture user={author} noTooltip noLink />
  19. <div className="users-meta">
  20. <h1 className="user-page-name">{author.name}</h1>
  21. <div className="user-page-meta mt-3 mb-0">
  22. <span className="user-page-username me-4">
  23. <span className="user-page-username me-4">
  24. <span className="material-symbols-outlined">person</span>
  25. {author.username}
  26. </span>
  27. </span>
  28. <span className="user-page-email me-2">
  29. <span className="material-symbols-outlined me-1">mail</span>
  30. {author.isEmailPublished ? author.email : '*****'}
  31. </span>
  32. {author.introduction && (
  33. <span className="user-page-introduction">
  34. {author.introduction}
  35. </span>
  36. )}
  37. </div>
  38. </div>
  39. </div>
  40. );
  41. };