UserInfo.tsx 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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">
  22. <span className="user-page-username me-4"><span className="material-symbols-outlined">person</span>{author.username}</span>
  23. </span>
  24. <span className="user-page-email me-2">
  25. <span className="material-symbols-outlined me-1">mail</span>
  26. { author.isEmailPublished
  27. ? author.email
  28. : '*****'
  29. }
  30. </span>
  31. { author.introduction && (
  32. <span className="user-page-introduction">{author.introduction}</span>
  33. ) }
  34. </div>
  35. </div>
  36. </div>
  37. );
  38. };