From c9938cf414ec394ebb6033f5917aa687c59c4398 Mon Sep 17 00:00:00 2001 From: t1enne Date: Tue, 28 Jun 2022 09:05:04 +0200 Subject: [PATCH] Added alternative styling for own messages in chat Added alternative styling for messages sent by self in chat Prettiered the file --- .../ChatUserMessage/ChatUserMessage.module.scss | 8 +++++++- .../chat/ChatUserMessage/ChatUserMessage.tsx | 13 ++++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/web/components/chat/ChatUserMessage/ChatUserMessage.module.scss b/web/components/chat/ChatUserMessage/ChatUserMessage.module.scss index d723172c3..8923c0fae 100644 --- a/web/components/chat/ChatUserMessage/ChatUserMessage.module.scss +++ b/web/components/chat/ChatUserMessage/ChatUserMessage.module.scss @@ -1,10 +1,10 @@ - .root { font-size: 0.9rem; padding: 5px; padding-left: 1rem; margin: 8px 5px; border-left: 2px solid; + border-radius: 0.3rem; .user { font: var(--theme-header-font-family); color: var(--color-owncast-grey-100); @@ -29,3 +29,9 @@ } } } + + +.ownMessage { + border-left: 0px; + border-right: 2px solid; +} diff --git a/web/components/chat/ChatUserMessage/ChatUserMessage.tsx b/web/components/chat/ChatUserMessage/ChatUserMessage.tsx index 117e96680..2294d9b1d 100644 --- a/web/components/chat/ChatUserMessage/ChatUserMessage.tsx +++ b/web/components/chat/ChatUserMessage/ChatUserMessage.tsx @@ -2,6 +2,7 @@ import { useEffect, useState } from 'react'; import { Highlight } from 'react-highlighter-ts'; import he from 'he'; +import cn from 'classnames'; import { ChatMessage } from '../../../interfaces/chat-message.model'; import { formatTimestamp } from './messageFmt'; import s from './ChatUserMessage.module.scss'; @@ -17,12 +18,12 @@ export default function ChatUserMessage({ message, highlightString, showModeratorMenu, - // eslint-disable-next-line @typescript-eslint/no-unused-vars renderAsPersonallySent, // Move the border to the right and render a background }: Props) { const { body, user, timestamp } = message; const { displayName, displayColor } = user; - const color = `hsl(${displayColor}, 100%, 70%)`; + const color = `hsl(${displayColor}, 100%, 65%)`; + const bgColor = `hsl(${displayColor}, 20%, 25%)`; const formattedTimestamp = `Sent at ${formatTimestamp(timestamp)}`; const [formattedMessage, setFormattedMessage] = useState(body); @@ -31,7 +32,13 @@ export default function ChatUserMessage({ }, [message]); return ( -
+
{displayName}