UserInfo.tsx 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import React 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 className={`${styles['grw-users-info']} grw-users-info d-flex align-items-center d-edit-none mb-5 pb-3 border-bottom`} data-testid="grw-users-info">
  15. <UserPicture user={author} />
  16. <div className="users-meta">
  17. <h1 className="user-page-name">
  18. {author.name}
  19. </h1>
  20. <div className="user-page-meta mt-3 mb-0">
  21. <span className="user-page-username me-4"><i className="icon-user me-1"></i>{author.username}</span>
  22. <span className="user-page-email me-2">
  23. <i className="icon-envelope me-1"></i>
  24. { author.isEmailPublished
  25. ? author.email
  26. : '*****'
  27. }
  28. </span>
  29. { author.introduction && (
  30. <span className="user-page-introduction">{author.introduction}</span>
  31. ) }
  32. </div>
  33. </div>
  34. </div>
  35. );
  36. };