-
Notifications
You must be signed in to change notification settings - Fork 646
feat(Popover): Add Popover component #703
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
Conversation
|
This pull request is being automatically deployed with ZEIT Now (learn more). 🔍 Inspect: https://zeit.co/primer/primer-components/8ddfgchem |
Since absolutely positioned elements are removed from the document flow, without the prop there would be no way to position it relatively without wrapping it and overriding the style. I'd be down for removing it if I could find another good solution, but none come to mind.
Keeping this controlled as per our discussion. |
|
@emplums This is ready for a second look 👀 |
|
@emplums The system props thing makes sense, thanks for elaborating. I think I got everything in the right place to allow the proper overrides without allowing the user to break the component. I also added the forgotten system props docs and updated the typings. I believe I've addressed all your feedback. Feel free to merge if you feel good about the current state! |
emplums
left a comment
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.
Looks great! 🙌 ✨ 🙌

Here's an initial stab at the
Popovercomponent.Since a consumer may want to control the absolute positioning of the component as well as the styling of the content of the component, I opted to split this into
PopoverandPopover.Content.Popovertakes all the functional props;Popover.Componentis just a highly-styledBorderBox.I've also taken a stab at a more complex interactive example in the docs, based on primer/doctocat#123, which allows one to preview every caret position in the same demo.
I would expect a component like this in a React component library to allow one to specify a target that the popover would "stick" to, but the version in
primer/cssdoesn't allow that so I decided to start here.This is still WIP but would love to get 💭s on the API/props and the example.
Closes #590
Merge checklist
index.d.ts) if necessary