-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
[base-ui] Create hooks contribution guide #38679
Conversation
Netlify deploy previewhttps://deploy-preview-38679--material-ui.netlify.app/ Bundle size report |
packages/mui-base/CONTRIBUTING.md
Outdated
Example: | ||
|
||
```tsx | ||
const getRootProps = <OtherProps extends EventHandlers>( |
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.
Why is the parameter named otherProps
here and otherHandlers
on the next example?
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.
Ah, sorry, my bad. I should have made it consistent.
Although it actually reflects the reality - we used to accept only event handlers in this parameter, but we're changing this to accept arbitrary props (#38186). So ultimately, it will be otherProps
.
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.
OK
This is clearly a small issue 😆
Co-authored-by: Diego Andai <[email protected]> Signed-off-by: Michał Dudak <[email protected]>
#### Parameters destructuring | ||
|
||
The parameters type must be called `[HookName]Parameters`. | ||
There are docs generation scripts that require this pattern. |
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 think we need more explanation here and an example. Where and how should the parameters be destructured?
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 can likely even drop this, contributors don't need this information at this point. It's an overhead that will not make them implement the hook itself better.
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.
IMO it does no harm to have this piece of information - it could help someone find a problem when the docs are not generated properly. Plus, MUIers can also use this doc.
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.
🚀
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.
Excellent work @michaldudak !
Co-authored-by: Sam Sycamore <[email protected]> Signed-off-by: Michał Dudak <[email protected]>
|
||
#### Parameters destructuring | ||
|
||
The parameters type must be called `[HookName]Parameters`. |
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.
The parameters type must be called `[HookName]Parameters`. | |
The parameters type must be called `[HookName]Parameters`, for e.g. for the above mentioned hook, they would be called `UseAwesomeControlParemeters`. |
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 can likely drop this as we anyway talk about it in the last section
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.
Overall looks great, I left few comments for consideration.
Co-authored-by: Diego Andai <[email protected]> Co-authored-by: Sam Sycamore <[email protected]>
Co-authored-by: Diego Andai <[email protected]> Co-authored-by: Sam Sycamore <[email protected]>
Co-authored-by: Diego Andai <[email protected]> Co-authored-by: Sam Sycamore <[email protected]>
Technical documentation for authoring Base UI hooks.