-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
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
[docs] Add Component name section to API docs #20434
Conversation
generateName() function adds the "Component Name" entry to a component's .md file. If the component does not have styling available there will be no entry. Style sheet name has been removed from generateProps as it is redundant.
Added function styleNameError() to throw an error when the component is missing a style name. The same error is thrown in the recently added generateName() function, so the error was consolidated to avoid DRY.
Details of bundle changes.Comparing: a2b2463...9e4ead4 Details of page changes
|
@@ -344,7 +363,7 @@ function generateClasses(reactAPI) { | |||
} | |||
|
|||
if (!reactAPI.styles.name) { | |||
throw new Error(`Missing styles name on ${reactAPI.name} component`); | |||
styleNameError(reactAPI.name); |
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 do we need this indirection? Be aware that this adds another line to the stack trace.
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.
Good point. The generateClasses() and generateName() functions both throw the same custom error, and I wasn't sure on the preference for avoiding repetition, so I wrapped it in a function.
e1d9154
to
0a5cc0d
Compare
0a5cc0d
to
9e4ead4
Compare
@Josh-Weston It's a great first pull request on Material-UI 👌🏻. Thank you for working on it! |
Fixes #17245
generateName() function added to generateMarkdonw.js to create "Component Name" entry in each component's .md file. If the component does not have styling available there will be no entry. "Style sheet" name line has been removed from generateProps() as it is now redundant. Markdown files updated and reviewed. Added function styleNameError() to throw an error when the component is missing a style name. The same error is thrown in the recently added generateName() function, so the error was consolidated to avoid DRY.