Page MenuHomePhabricator

[web] extend navigation sidebar tooltip api
ClosedPublic

Authored by ginsu on Dec 27 2023, 9:37 PM.
Tags
None
Referenced Files
Unknown Object (File)
Apr 5 2024, 10:39 PM
Unknown Object (File)
Apr 4 2024, 12:31 PM
Unknown Object (File)
Apr 4 2024, 12:31 PM
Unknown Object (File)
Apr 4 2024, 12:31 PM
Unknown Object (File)
Apr 4 2024, 12:29 PM
Unknown Object (File)
Apr 4 2024, 12:28 PM
Unknown Object (File)
Apr 3 2024, 6:26 AM
Unknown Object (File)
Feb 20 2024, 6:34 PM
Subscribers

Details

Summary

In the new community header/topbar, we will be introducing some buttons that when hovered, a tooltip will be rendered below the element at a smaller margin (16px instead of 24px). At the moment, the only direction the navigation sidebar tooltip can go is right with 24px of margin. So this diff extends the api of the navigation sidebar tooltip to take in a tooltip position and a margin size and will render the navigation sidebar tooltip based off these new parameters.

Also please note, I am aware naming this component a navigation sidebar tooltip is probably now a bit dated, but in the very next diff I will update the name of this component to be something more generic

For context here is what the buttons on the community header/topbar will look like:

Screenshot 2023-12-28 at 12.39.47 AM.png (568×596 px, 36 KB)

Depends on D10471

Test Plan

Please see the screenshots below. Also witch each example below I confirmed that the tooltip size returned by calculateNavigationSidebarTooltipSize correctly matched the size of the element

right w/ 16px of margin

Screenshot 2023-12-28 at 12.44.59 AM.png (222×390 px, 13 KB)

left w/24 px of margin

Screenshot 2023-12-28 at 12.45.28 AM.png (322×354 px, 18 KB)

top w/ 24px of margin

Screenshot 2023-12-28 at 12.46.23 AM.png (302×432 px, 18 KB)

bottom w/ 16px of margin

Screenshot 2023-12-28 at 12.47.01 AM.png (300×308 px, 17 KB)

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

ginsu edited the test plan for this revision. (Show Details)
ginsu added reviewers: atul, rohan, kamil.
ginsu requested review of this revision.Dec 27 2023, 9:55 PM

Seems reasonable, just a note about making tooltipMarginStyle more concise.

(As an aside, it seems like the tooltip calculating/styling code keeps getting more complex. Still feel that going with something like https://floating-ui.com would've been better so we could just not think about tooltips.)

web/navigation-sidebar/navigation-sidebar-toolitp.react.js
22–44 ↗(On Diff #35039)

Could we replace this with something like:

const tooltipMarginStyle = React.useMemo(() => ({
  marginLeft: position === tooltipPositions.RIGHT ? tooltipMargin : 0,
  marginRight: position === tooltipPositions.LEFT ? tooltipMargin : 0,
  marginTop: position === tooltipPositions.BOTTOM ? tooltipMargin : 0,
  marginBottom: position === tooltipPositions.TOP ? tooltipMargin : 0,
}), [position, tooltipMargin]);

?

This revision is now accepted and ready to land.Dec 28 2023, 4:39 PM

address comments + rebase before landing

This revision was landed with ongoing or failed builds.Dec 28 2023, 6:45 PM
This revision was automatically updated to reflect the committed changes.