-
-
Notifications
You must be signed in to change notification settings - Fork 272
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
Popover component for floating content next to a target element #16481
Conversation
24ada5f
to
8c168a2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beautiful 🚀 🥳
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this PR very much. Good job @izmy 👏
I added few comments, but mostly nitpicks, no real blocker from my side.
); | ||
}); | ||
|
||
export function Popover({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
offtopic: shouldn't we also abstract Tooltip
to Popover
similarly like Dropdown
? Does it make sense? WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, Tootip has a similar implementation, because it also uses @floating-ui/react
, so I think it makes sense for me.
packages/suite/src/components/suite/layouts/SuiteLayout/Sidebar/NavigationItem.tsx
Outdated
Show resolved
Hide resolved
5c275fd
to
4db6013
Compare
4db6013
to
80fc82f
Compare
d9e8512
to
ee8217b
Compare
/rebase |
Start rebasing: https://github.com/trezor/trezor-suite/actions/runs/13010996511 |
Rebasing failed, please rebase manually. |
ee8217b
to
641394f
Compare
Description
Previously, the dropdown could render outside the viewport, particularly on smaller screens. So I created a new Popover component to keep content within the viewport. The component monitors whether the content is visible and dynamically adjusts its position when necessary. I used the
@floating-ui/react
library for this functionality, which is already used for tooltips.I also refactored the
Dropdown
component, then separated theMenu
file, and created an example in the storybook.Related Issue
Resolve #12939
Screenshots: