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][Backdrop] Improvements to docs #34244

Merged
merged 6 commits into from
Apr 10, 2023
Merged

Conversation

alirezahekmati
Copy link
Contributor

@alirezahekmati alirezahekmati commented Sep 9, 2022

this is the js file that I added from the MUI doc example and here are two things that we solve:

  1. changing color: '#fff'(line41) to background: "#333333e6" since setting color won't do anything in the backdrop but setting background color will actually change backdrop color.

  2. handleToggle(line33) doesn't need to be a toggle since it's not togglable! when the backdrop opens there is no access by clicking it so it basically can only open the dialog in this case it's better to write it this way:

handleOpen = () => {
setOpen(true)
};

at the same time even if we don't change the function it still has some problems you shouldn't change the state value directly so it has the be like this :

 const handleToggle = () => {
    setOpen(value => !value);
  };

Signed-off-by: alireza 94165013+alirezahekmati@users.noreply.github.com

Sorry, something went wrong.

this is the js file that I added from the MUI doc example and here are two things that we solve:

1. changing color: '#fff'(line41) to background: "#333333e6" since setting color won't do anything in the backdrop but setting background color will actually change backdrop color.

2. handleToggle(line33) doesn't need to be a toggle since it's not togglable!  when the backdrop opens there is no access by clicking it so it basically can only open the dialog in this case it's better to write it this way:
```
handleOpen = () => {
setOpen(true)
};
```
at the same time even if we don't change the function it still has some problems you shouldn't change the state value directly
so it has the be like this :
```
 const handleToggle = () => {
    setOpen(value => !value);
  };
```


Signed-off-by: alireza <94165013+alirezahekmati@users.noreply.github.com>
@alirezahekmati
Copy link
Contributor Author

please read the comment first the changes in the repo are here only to help you to see the example from the doc since it's not shown here.

@mui-bot
Copy link

mui-bot commented Sep 9, 2022

Netlify deploy preview

Bundle size report

No bundle size changes

Generated by 🚫 dangerJS against 5b16f07

@alirezahekmati alirezahekmati marked this pull request as draft September 14, 2022 12:29
@alirezahekmati alirezahekmati marked this pull request as ready for review September 14, 2022 12:32
@siriwatknp
Copy link
Member

changing color: '#fff'(line41) to background: "#333333e6" since setting color won't do anything in the backdrop but setting background color will actually change backdrop color.

I believe that the color is to show the circular progress:
Screen Shot 2565-09-15 at 10 21 32

Sounds good to me if you want to add background to the demo since it is a pretty common customization.

handleToggle(line33) doesn't need to be a toggle since it's not togglable! when the backdrop opens there is no access by clicking it so it basically can only open the dialog in this case it's better to write it this way:

I am good with your proposal. This is a simple demo, setOpen(true) is enough.

Copy link
Member

@siriwatknp siriwatknp left a comment

Choose a reason for hiding this comment

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

Please change the demo file (.tsx, .js) instead of the markdown.

@danilo-leal danilo-leal changed the title changing the backdrop.md to avoid confusion. [docs] Add code snippet to the Backdrop's example section Sep 15, 2022
@danilo-leal danilo-leal added docs Improvements or additions to the documentation component: backdrop This is the name of the generic UI component, not the React module! labels Sep 15, 2022
@mapache-salvaje mapache-salvaje self-assigned this Mar 30, 2023
@mapache-salvaje
Copy link
Contributor

@siriwatknp I moved the new demo code to where it belongs, and took the opportunity to do some light copy editing on the page as well. I think it's ready to go now!

@ZeeshanTamboli ZeeshanTamboli changed the title [docs] Add code snippet to the Backdrop's example section [docs][Backdrop] Improvements to docs Apr 10, 2023
Copy link
Member

@ZeeshanTamboli ZeeshanTamboli left a comment

Choose a reason for hiding this comment

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

@samuelsycamore I pushed the following two commits:

  1. You removed the code snippet from markdown but the demo code was not updated as proposed by the author - faf1235
  2. Changed text to CircularProgress component - 5b16f07

Looks good now!

@ZeeshanTamboli ZeeshanTamboli merged commit 17d4b9e into mui:master Apr 10, 2023
@ZeeshanTamboli ZeeshanTamboli mentioned this pull request Apr 10, 2023
1 task
@@ -16,7 +16,7 @@ In its simplest form, the Backdrop component will add a dimmed layer over your a

## Example

The demo below shows a basic Backdrop with a Circular Progress component in the foreground to indicate a loading state.
The demo below shows a basic Backdrop with a `CircularProgress` component in the foreground to indicate a loading state.
Copy link
Contributor

Choose a reason for hiding this comment

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

This was correct before—see Style conventions for components from the Handbook Style Guide. The backtick style is an old convention being phased out.

Copy link
Member

Choose a reason for hiding this comment

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

Okay. I was not aware of it. Reverting it in #36837.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: backdrop This is the name of the generic UI component, not the React module! docs Improvements or additions to the documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants