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

[docs-infra] New Component API design followup #38183

Merged
merged 17 commits into from
Aug 2, 2023

Conversation

cherniavskii
Copy link
Member

@cherniavskii cherniavskii commented Jul 27, 2023

Follow-up for #37405
I've added an explanatory comment for each change I did, all other changes are generated by the docs:api script.

Example page: https://deploy-preview-38183--material-ui.netlify.app/joy-ui/api/alert/

TODO:

  • Update MUI X once this PR is merged

@mui-bot
Copy link

mui-bot commented Jul 27, 2023

Netlify deploy preview

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

Bundle size report

No bundle size changes (Toolpad)
No bundle size changes

Generated by 🚫 dangerJS against 07ea0a1

@@ -88,7 +88,7 @@ export default function PropertiesTable(props) {
.filter((key) => propData.additionalInfo?.[key])
.map((key) => (
<p
className="prop-list-additional-info"
className="prop-list-description"
Copy link
Member Author

Choose a reason for hiding this comment

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

Before After

Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be possible to add this content in an info callout?
Additionally, it'd be great to render content wrapped in backticks as a code block!

Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: how about putting "the" in the link? Like:

See the sx page for more details.

Copy link
Member

Choose a reason for hiding this comment

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

Not sure about the info callout. It's the kind of text you read once, then you can ignore it.

It's for new users encountering this kind of props for the first time, they got the link to the docs just next to the description they did not understand.

Copy link
Contributor

Choose a reason for hiding this comment

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

Uhm... alright, I see your point ⎯ adding the callout would put too much unnecessary emphasis.
Another copy suggestion to not repeat sx:

See the documentation for more details.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, those wordings did not get attention for a long time. They could get some reviews from @samuelsycamore all together at once

Here you can find all the API descriptions added automatically

typeDescriptions[name] = renderMarkdownInline(description);
},
);
(signatureArgs || []).concat(signatureReturn || []).forEach(({ name, description }) => {
Copy link
Member Author

Choose a reason for hiding this comment

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

Just a simplification

@@ -563,7 +562,8 @@ const attachPropsTable = (reactApi: ReactApi) => {
deprecationInfo:
renderMarkdownInline(deprecation?.groups?.info || '').trim() || undefined,
signature,
...(Object.keys(additionalPropsInfo).length === 0 ? {} : { additionalPropsInfo }),
additionalInfo:
Copy link
Member Author

Choose a reason for hiding this comment

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

It was a typo

Before After

Copy link
Contributor

Choose a reason for hiding this comment

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

Similarly here, it'd be great to have these in an info callout. Also, I think I'd probably put it below the "Default" text ⎯ it's complementary & generic info whereas "Type" & "Default" are the prop's main pieces of content.

Copy link
Contributor

Choose a reason for hiding this comment

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

About the text itself, how about:

See the Slots API section below for more details.

Then, similar to the above, having "the Slots API section" as the link!

const componentProps: ReactApi['propsTable'] = _.fromPairs(
Object.entries(reactApi.props!).map(([propName, propDescriptor]) => {
Object.entries(reactApi.props!).map(([propName, propDescriptor]): Pair => {
Copy link
Member Author

Choose a reason for hiding this comment

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

Improved typing to prevent typos like additionalPropsInfo below

@cherniavskii cherniavskii marked this pull request as ready for review July 27, 2023 11:00
@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Jul 29, 2023
@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Jul 31, 2023
@danilo-leal danilo-leal added the design This is about UI or UX design, please involve a designer label Jul 31, 2023
@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Aug 1, 2023
@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Aug 1, 2023
@alexfauquette
Copy link
Member

alexfauquette commented Aug 1, 2023

I realized the slots did not get enough care, so I added a few tweaks to:

  • avoid the "required" everywhere
  • the semi-bold font for slot description

To avoid further CSS errors, I've split the CSS dedicated to slots and the CSS dedicated to props

The before after

image

Copy link
Member

@alexfauquette alexfauquette left a comment

Choose a reason for hiding this comment

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

Thanks for the clear PR 👌

@alexfauquette alexfauquette merged commit 1d1e96d into mui:master Aug 2, 2023
21 checks passed
@cherniavskii cherniavskii deleted the update-component-api-page branch August 2, 2023 12:12
richbustos pushed a commit that referenced this pull request Aug 4, 2023
Co-authored-by: alexandre <alex.fauquette@gmail.com>
richbustos pushed a commit that referenced this pull request Aug 7, 2023
Co-authored-by: alexandre <alex.fauquette@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design This is about UI or UX design, please involve a designer scope: docs-infra Specific to the docs-infra product
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants