-
-
Notifications
You must be signed in to change notification settings - Fork 50
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
[popups] Create Portal
part
#937
Conversation
atomiks
commented
Dec 2, 2024
- I have followed (at least) the PR section of the contributing guide.
Netlify deploy preview |
It seems to me we could gain quite a lot by inverting the dependencies. Instead of a separate |
) { | ||
const { children, container, keepMounted = false } = props; | ||
|
||
const { mounted } = useAlertDialogRootContext(); |
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.
We agreed to use the term visible
instead of mounted
.
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.
mounted
is used everywhere currently and doesn't relate to this PR. We can change it but it's not necessary/not exposed to publicly right now
Not sure I fully understand - these separate Portal components are really small, I think the context would add more size if anything. Portal re-rendering is a non-issue since it's cheap |
They are small, but they are copied 7 times. Defining it just once (plus the context, which will be even smaller, I suppose) would make the package lighter. I realize that rendering a Portal isn't a perf bottleneck, but if we can easily save a few CPU cycles, why not? |
const customAnnotation = `Documentation: [Base UI ${parentComponentName}](${url})`; | ||
// Foreign components that aren't associated with any given component. | ||
const EXCLUDED_NAMES = ['Portal']; | ||
|
||
const customAnnotation = EXCLUDED_NAMES.includes(name) | ||
? `Documentation: https://base-ui.com` | ||
: `Documentation: [Base UI ${parentComponentName}](${url})`; |
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.
Foreign standalone components (which aren't used standalone in terms of the public API and have no dedicated page) can't be associated to their component without wrapping. We can either always wrap (which is already required for Select
) or just link to the homepage?
@@ -0,0 +1,13 @@ | |||
import * as React from 'react'; | |||
|
|||
export const PortalContext = React.createContext<boolean | undefined>(undefined); |
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.
Add the displayName