Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3323322
D10357.id34929.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D10357.id34929.diff
View Options
diff --git a/web/navigation-sidebar/navigation-sidebar-constants.js b/web/navigation-sidebar/navigation-sidebar-constants.js
--- a/web/navigation-sidebar/navigation-sidebar-constants.js
+++ b/web/navigation-sidebar/navigation-sidebar-constants.js
@@ -1,5 +1,9 @@
// @flow
+export const navigationSidebarTooltipContainerStyle = {
+ marginLeft: 24,
+};
+
export const navigationSidebarTooltipStyle = {
paddingTop: 8,
paddingBottom: 8,
diff --git a/web/navigation-sidebar/navigation-sidebar-toolitp.react.js b/web/navigation-sidebar/navigation-sidebar-toolitp.react.js
--- a/web/navigation-sidebar/navigation-sidebar-toolitp.react.js
+++ b/web/navigation-sidebar/navigation-sidebar-toolitp.react.js
@@ -2,7 +2,10 @@
import * as React from 'react';
-import { navigationSidebarTooltipStyle } from './navigation-sidebar-constants.js';
+import {
+ navigationSidebarTooltipContainerStyle,
+ navigationSidebarTooltipStyle,
+} from './navigation-sidebar-constants.js';
import css from './navigation-sidebar-tooltip.css';
type Props = {
@@ -13,7 +16,10 @@
const { tooltipLabel } = props;
return (
- <div className={css.container}>
+ <div
+ className={css.container}
+ style={navigationSidebarTooltipContainerStyle}
+ >
<div className={css.arrowLeft} />
<div className={css.tooltipLabel} style={navigationSidebarTooltipStyle}>
{tooltipLabel}
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,10 @@
reactionSeeMoreLabel,
} from '../chat/chat-constants.js';
import type { PositionInfo } from '../chat/position-types.js';
+import {
+ navigationSidebarTooltipContainerStyle,
+ navigationSidebarTooltipStyle,
+} from '../navigation-sidebar/navigation-sidebar-constants.js';
import { calculateMaxTextWidth } from '../utils/text-utils.js';
export const tooltipPositions = Object.freeze({
@@ -407,9 +411,33 @@
};
}
+function calculateNavigationSidebarTooltipSize(
+ tooltipLabel: string,
+): TooltipSize {
+ const { marginLeft } = navigationSidebarTooltipContainerStyle;
+ const {
+ paddingLeft,
+ paddingRight,
+ paddingTop,
+ paddingBottom,
+ height: contentHeight,
+ } = navigationSidebarTooltipStyle;
+
+ 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,
};
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Nov 21, 3:33 AM (21 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2552465
Default Alt Text
D10357.id34929.diff (2 KB)
Attached To
Mode
D10357: [web] introduce calculateNavigationSidebarTooltipSize
Attached
Detach File
Event Timeline
Log In to Comment