From 71fdad0b8294de07e012f84f01d1e010273d16a9 Mon Sep 17 00:00:00 2001
From: Jeffrey Yu <35394596+JeffreytheCoder@users.noreply.github.com>
Date: Mon, 4 Mar 2024 11:12:53 -0800
Subject: [PATCH] Add tooltips to message toolbox
---
.../src/components/Message/MessageToolbox.js | 115 +++++++++++-------
.../react/src/components/Tooltip/Tooltip.js | 2 +-
2 files changed, 70 insertions(+), 47 deletions(-)
diff --git a/packages/react/src/components/Message/MessageToolbox.js b/packages/react/src/components/Message/MessageToolbox.js
index 8826bc026..0e45bb379 100644
--- a/packages/react/src/components/Message/MessageToolbox.js
+++ b/packages/react/src/components/Message/MessageToolbox.js
@@ -10,6 +10,7 @@ import { Modal } from '../Modal';
import { Icon } from '../Icon';
import { Button } from '../Button';
import { parseEmoji } from '../../lib/emoji';
+import { Tooltip } from '../Tooltip';
const MessageToolboxWrapperCss = css`
display: none;
@@ -88,30 +89,44 @@ export const MessageToolbox = ({
{...props}
>
{!isThreadMessage ? (
+
+
+
+ ) : null}
+ u._id === authenticatedUserId)
+ ? 'Remove star'
+ : 'Star'
+ }
+ position="top"
+ >
u._id === authenticatedUserId)
+ ? 'star-filled'
+ : 'star'
+ }`}
+ onClick={() => handleStarMessage(message)}
/>
- ) : null}
- u._id === authenticatedUserId)
- ? 'star-filled'
- : 'star'
- }`}
- onClick={() => handleStarMessage(message)}
- />
- setEmojiOpen(true)}
- />
+
+
+ setEmojiOpen(true)}
+ />
+
{!isThreadMessage && (
- handlePinMessage(message)}
- />
- )}
- {message.u._id === authenticatedUserId && (
- <>
- handleEditMessage(message)}
- />
+
handleClickDelete(message)}
+ icon={`${message.pinned ? 'pin-filled' : 'pin'}`}
+ onClick={() => handlePinMessage(message)}
/>
+
+ )}
+ {message.u._id === authenticatedUserId && (
+ <>
+
+ handleEditMessage(message)}
+ />
+
+
+ handleClickDelete(message)}
+ />
+
>
)}
- handlerReportMessage(message)}
- />
+
+ handlerReportMessage(message)}
+ />
+
{showDeleteModal && (
diff --git a/packages/react/src/components/Tooltip/Tooltip.js b/packages/react/src/components/Tooltip/Tooltip.js
index f014ae9dc..2e7612c2d 100644
--- a/packages/react/src/components/Tooltip/Tooltip.js
+++ b/packages/react/src/components/Tooltip/Tooltip.js
@@ -31,7 +31,7 @@ const Tooltip = ({ children, text, position }) => {
// Add more positions according to your needs and modify tooltipStyle and tooltipArrowStyle accordingly
if (position === 'top') {
- tooltipStyle.top = '-100%';
+ tooltipStyle.top = 'calc(-100% - 10px)'; // avoid overlaying the element
tooltipArrowStyle.top = '100%';
tooltipArrowStyle.transform = 'translateX(-50%)';
} else if (position === 'bottom') {