ChatJoinMessage.tsx 933 B

1234567891011121314151617181920212223242526272829303132333435
  1. import { FC } from 'react';
  2. import { TeamOutlined } from '@ant-design/icons';
  3. import { ChatUserBadge } from '~/components/chat/ChatUserBadge/ChatUserBadge';
  4. import styles from './ChatJoinMessage.module.scss';
  5. export type ChatJoinMessageProps = {
  6. isAuthorModerator: boolean;
  7. userColor: number;
  8. displayName: string;
  9. };
  10. export const ChatJoinMessage: FC<ChatJoinMessageProps> = ({
  11. isAuthorModerator,
  12. userColor,
  13. displayName,
  14. }) => {
  15. const color = `var(--theme-color-users-${userColor})`;
  16. return (
  17. <div className={styles.root}>
  18. <span style={{ color }}>
  19. <span style={{ padding: '0 10px' }}>
  20. <TeamOutlined />
  21. </span>
  22. <span style={{ fontWeight: 'bold' }}>{displayName}</span>
  23. {isAuthorModerator && (
  24. <span>
  25. <ChatUserBadge badge="mod" userColor={userColor} />
  26. </span>
  27. )}
  28. </span>{' '}
  29. joined the chat.
  30. </div>
  31. );
  32. };