You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1011 B
42 lines
1011 B
import { FC } from 'react'; |
|
import dynamic from 'next/dynamic'; |
|
import { ModerationBadge } from '../ChatUserBadge/ModerationBadge'; |
|
|
|
import styles from './ChatJoinMessage.module.scss'; |
|
|
|
// Lazy loaded components |
|
|
|
const TeamOutlined = dynamic(() => import('@ant-design/icons/TeamOutlined'), { |
|
ssr: false, |
|
}); |
|
|
|
export type ChatJoinMessageProps = { |
|
isAuthorModerator: boolean; |
|
userColor: number; |
|
displayName: string; |
|
}; |
|
|
|
export const ChatJoinMessage: FC<ChatJoinMessageProps> = ({ |
|
isAuthorModerator, |
|
userColor, |
|
displayName, |
|
}) => { |
|
const color = `var(--theme-color-users-${userColor})`; |
|
|
|
return ( |
|
<div className={styles.root}> |
|
<span style={{ color }}> |
|
<span className={styles.icon}> |
|
<TeamOutlined /> |
|
</span> |
|
<span className={styles.user}>{displayName}</span> |
|
{isAuthorModerator && ( |
|
<span> |
|
<ModerationBadge userColor={userColor} /> |
|
</span> |
|
)} |
|
</span>{' '} |
|
joined the chat. |
|
</div> |
|
); |
|
};
|
|
|