UserInfo.tsx 1.4 KB

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