Add standalone join message with user badge

This commit is contained in:
Gabe Kangas
2022-08-21 15:50:22 -07:00
parent 1954169ca1
commit 6cc184ea6f
8 changed files with 82 additions and 6 deletions

View File

@@ -0,0 +1,27 @@
import s from './ChatJoinMessage.module.scss';
import ChatUserBadge from '../ChatUserBadge/ChatUserBadge';
interface Props {
isAuthorModerator: boolean;
userColor: number;
displayName: string;
}
export default function ChatJoinMessage(props: Props) {
const { isAuthorModerator, userColor, displayName } = props;
const color = `var(--theme-user-colors-${userColor})`;
return (
<div className={s.join}>
<span style={{ color }}>
{displayName}
{isAuthorModerator && (
<span>
<ChatUserBadge badge="mod" userColor={userColor} />
</span>
)}
</span>{' '}
joined the chat.
</div>
);
}