Skip to content
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

Merged
merged 7 commits into from
Sep 7, 2023

Conversation

michaldudak
Copy link
Member

Technical documentation for authoring Base UI hooks.

@michaldudak michaldudak added docs Improvements or additions to the documentation package: base-ui Specific to @mui/base labels Aug 28, 2023
@michaldudak michaldudak requested review from samuelsycamore and a team August 28, 2023 09:33
@mui-bot
Copy link

mui-bot commented Aug 28, 2023

Netlify deploy preview

https://deploy-preview-38679--material-ui.netlify.app/

Bundle size report

No bundle size changes (Toolpad)
No bundle size changes

Generated by 🚫 dangerJS against 4081c72

Example:

```tsx
const getRootProps = <OtherProps extends EventHandlers>(
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member

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 😆

packages/mui-base/CONTRIBUTING.md Outdated Show resolved Hide resolved
packages/mui-base/CONTRIBUTING.md Outdated Show resolved Hide resolved
Comment on lines +27 to +30
#### Parameters destructuring

The parameters type must be called `[HookName]Parameters`.
There are docs generation scripts that require this pattern.
Copy link
Member

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?

Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member

@DiegoAndai DiegoAndai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

Copy link
Contributor

@samuelsycamore samuelsycamore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent work @michaldudak !

packages/mui-base/CONTRIBUTING.md Outdated Show resolved Hide resolved
Co-authored-by: Sam Sycamore <[email protected]>
Signed-off-by: Michał Dudak <[email protected]>
@michaldudak michaldudak enabled auto-merge (squash) September 1, 2023 06:38

#### Parameters destructuring

The parameters type must be called `[HookName]Parameters`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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`.

Copy link
Member

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

Copy link
Member

@mnajdova mnajdova left a 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.

@michaldudak michaldudak merged commit 8bf7458 into mui:master Sep 7, 2023
4 of 5 checks passed
@michaldudak michaldudak deleted the base-ui-contribution-docs branch September 7, 2023 08:22
mnajdova pushed a commit to mnajdova/material-ui that referenced this pull request Sep 8, 2023
mnajdova pushed a commit to mnajdova/material-ui that referenced this pull request Sep 8, 2023
xcode-it pushed a commit to xcode-it/material-ui that referenced this pull request Sep 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Improvements or additions to the documentation package: base-ui Specific to @mui/base
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants