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] Tweak buildReference script #1062

Merged
merged 9 commits into from
Dec 12, 2024

Conversation

mj12albert
Copy link
Member

@mj12albert mj12albert commented Dec 12, 2024

Fixes #1061
Also fixes #990 (comment)

@mj12albert mj12albert added the docs Improvements or additions to the documentation label Dec 12, 2024
@mui-bot
Copy link

mui-bot commented Dec 12, 2024

Netlify deploy preview

https://deploy-preview-1062--base-ui.netlify.app/

Generated by 🚫 dangerJS against 0596da6

@mj12albert mj12albert force-pushed the docs/select-props-override branch from 98dd7d5 to b7a0518 Compare December 12, 2024 09:54
@mj12albert mj12albert force-pushed the docs/select-props-override branch from 6b009a3 to d0e455c Compare December 12, 2024 10:46
@mj12albert mj12albert changed the title [docs] Fix select root docs [docs] Tweak buildReference script and fix select docs Dec 12, 2024
@@ -70,7 +70,7 @@ export async function buildReference() {
const descriptionData: PropsTranslations = JSON.parse(descriptionJsonContents);

for (const prop in props) {
props[prop].description = descriptionData.propDescriptions[prop]?.description;
props[prop].description ??= descriptionData.propDescriptions[prop]?.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.

Fixes when a description is specified in overrides/*.json but not reflected in the generated one

Copy link
Member Author

@mj12albert mj12albert Dec 12, 2024

Choose a reason for hiding this comment

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

(Probably only happens to something that is not literally an "override" like children)

@@ -93,7 +93,7 @@ export async function buildReference() {
const json: ComponentDef = {
name: componentData.name,
description: descriptionData.componentDescription,
props,
props: Object.fromEntries(Object.entries(props).sort()),
Copy link
Member Author

@mj12albert mj12albert Dec 12, 2024

Choose a reason for hiding this comment

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

If there are "overrides" the props would not be sorted alphabetically, e.g. https://master--base-ui.netlify.app/react/components/radio#root

Copy link
Contributor

Choose a reason for hiding this comment

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

Would be good to leave this as a comment in code

@mj12albert mj12albert added scope: docs-infra Specific to the docs-infra product and removed docs Improvements or additions to the documentation labels Dec 12, 2024
@mj12albert mj12albert changed the title [docs] Tweak buildReference script and fix select docs [docs-infra] Tweak buildReference script and fix select docs Dec 12, 2024
@mj12albert mj12albert changed the title [docs-infra] Tweak buildReference script and fix select docs [docs-infra] Tweak buildReference script Dec 12, 2024
@mj12albert mj12albert marked this pull request as ready for review December 12, 2024 11:03
@mj12albert mj12albert requested a review from vladmoroz December 12, 2024 11:03
"props": {
"children": {
"type": "React.ReactElement | (value) => React.ReactElement",
"description": "Allows you to customize the rendering of the text.\n\nAccepts a `ReactElement` or a function that returns the element to render."
Copy link
Member Author

@mj12albert mj12albert Dec 12, 2024

Choose a reason for hiding this comment

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

@vladmoroz If you're ok with this description I'll use the same for Slider.Value

Copy link
Contributor

@vladmoroz vladmoroz Dec 12, 2024

Choose a reason for hiding this comment

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

I’d say:

Override children if you need to customize how the value is displayed.
By default, renders the current value as is.

Accepts a `ReactElement` or a function that returns the element to render.

Also, shouldn't the children allow React.ReactNode instead of React.ReactElement? So then we'd say

Accepts a `ReactNode` or a function that returns the node to render.

@mj12albert mj12albert force-pushed the docs/select-props-override branch from fc4f504 to 938d581 Compare December 12, 2024 14:23
@mj12albert mj12albert merged commit 7f3021a into mui:master Dec 12, 2024
23 checks passed
@mj12albert mj12albert deleted the docs/select-props-override branch December 12, 2024 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: docs-infra Specific to the docs-infra product
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Select] The onValueChange and onOpenChange typing are not correct on the doc
3 participants