Skip to content

Commit

Permalink
[material-ui][docs] Broken demo in the Progress page in the Material …
Browse files Browse the repository at this point in the history
…3 section mui#40420
  • Loading branch information
patrickxunuo committed Jan 4, 2024
1 parent fd461cd commit a4c4f78
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions docs/src/modules/components/MaterialYouUsageDemo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -352,10 +352,18 @@ export default function MaterialYouUsageDemo<T extends { [k: string]: any } = {}
placeholder="Select a variant..."
value={(resolvedValue || 'none') as string}
onChange={(event) => {
setProps((latestProps) => ({
...latestProps,
[propName]: event.target.value,
}));
setProps((latestProps) => {
const variantShouldSpecialUpdate =
componentName === 'LinearProgress' &&
propName === 'type' &&
event.target.value === 'CircularProgress' &&
!['indeterminate', 'determinate'].includes(latestProps.variant);
return {
...latestProps,
variant: variantShouldSpecialUpdate ? 'indeterminate' : latestProps.variant,
[propName]: event.target.value,
}
});
onChange?.(event as React.SyntheticEvent);
}}
>
Expand Down

0 comments on commit a4c4f78

Please sign in to comment.