Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Moved hasActiveReply ternary condition outside of the class #686

Merged
merged 1 commit into from
Aug 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions client/src/components/Chat.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -437,15 +437,20 @@ const Chat = () => {

// is this message currently being replied?
const hasActiveReply = currentReplyMessageId === id;
const activeReplyClass = hasActiveReply ? 'bg-[#FF9F1C]/25 border-[#FF9F1C]' : '';
const activeReplySenderClass = hasActiveReply
? isSender
? 'border-r-[3.5px]'
: 'border-l-[3.5px]'
: '';

return (
<div
key={id}
id={`message-${id}`}
className={`
flex flex-col gap-2 py-2 duration-500 transition-all
${hasActiveReply ? 'bg-[#FF9F1C]/25 border-[#FF9F1C]' : ''},
${hasActiveReply ? (isSender ? 'border-r-[3.5px]' : 'border-l-[3.5px]') : ''}`}
flex flex-col gap-2 py-2 duration-500 transition-all
${activeReplyClass} ${activeReplySenderClass}`}
>
{replyTo && (
<div
Expand Down
Loading