diff --git a/web/utils/tooltip-utils.js b/web/utils/tooltip-utils.js --- a/web/utils/tooltip-utils.js +++ b/web/utils/tooltip-utils.js @@ -12,6 +12,7 @@ reactionSeeMoreLabel, } from '../chat/chat-constants.js'; import type { PositionInfo } from '../chat/position-types.js'; +import { navigationSidebarTooltipStyle } from '../navigation-sidebar/navigation-sidebar-constants.js'; import { calculateMaxTextWidth } from '../utils/text-utils.js'; export const tooltipPositions = Object.freeze({ @@ -407,9 +408,33 @@ }; } +function calculateNavigationSidebarTooltipSize( + tooltipLabel: string, +): TooltipSize { + const { + paddingLeft, + paddingRight, + paddingTop, + paddingBottom, + height: contentHeight, + } = navigationSidebarTooltipStyle; + + const marginLeft = 24; + const tooltipLabelTextWidth = calculateMaxTextWidth([tooltipLabel], 14); + + const width = marginLeft + paddingLeft + tooltipLabelTextWidth + paddingRight; + const height = paddingTop + contentHeight + paddingBottom; + + return { + width, + height, + }; +} + export { findTooltipPosition, getTooltipPositionStyle, calculateMessageTooltipSize, calculateReactionTooltipSize, + calculateNavigationSidebarTooltipSize, };