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] Add docs page for unstyled Modal #31417

Merged
merged 57 commits into from
Mar 25, 2022
Merged

Conversation

mnajdova
Copy link
Member

@mnajdova mnajdova commented Mar 11, 2022

Preview - https://deploy-preview-31417--material-ui.netlify.app/base/react-modal/

TODOs:

Note:

We need to adjust the API a bit, BackdropComponent and BackdropProps should be part of components & componentsProps. Will resolve it in a follow up PR.

@mui-bot
Copy link

mui-bot commented Mar 11, 2022

No bundle size changes

Generated by 🚫 dangerJS against 4b10c9b

@danilo-leal danilo-leal added the docs Improvements or additions to the documentation label Mar 11, 2022
@mnajdova mnajdova marked this pull request as ready for review March 14, 2022 12:59
docs/data/base/components/modal/modal.md Outdated Show resolved Hide resolved
docs/data/base/components/modal/modal.md Outdated Show resolved Hide resolved
docs/data/base/components/modal/modal.md Outdated Show resolved Hide resolved
docs/data/base/components/modal/modal.md Outdated Show resolved Hide resolved
docs/data/base/components/modal/modal.md Outdated Show resolved Hide resolved
docs/data/base/components/modal/modal.md Outdated Show resolved Hide resolved
docs/data/base/components/modal/modal.md Outdated Show resolved Hide resolved
docs/data/base/components/modal/modal.md Outdated Show resolved Hide resolved
docs/data/base/components/modal/modal.md Outdated Show resolved Hide resolved
docs/data/base/components/modal/modal.md Outdated Show resolved Hide resolved
mnajdova and others added 16 commits March 14, 2022 20:34
Co-authored-by: Sam Sycamore <71297412+samuelsycamore@users.noreply.github.com>
Co-authored-by: Sam Sycamore <71297412+samuelsycamore@users.noreply.github.com>
Co-authored-by: Sam Sycamore <71297412+samuelsycamore@users.noreply.github.com>
Co-authored-by: Sam Sycamore <71297412+samuelsycamore@users.noreply.github.com>
Co-authored-by: Sam Sycamore <71297412+samuelsycamore@users.noreply.github.com>
Co-authored-by: Sam Sycamore <71297412+samuelsycamore@users.noreply.github.com>
Co-authored-by: Sam Sycamore <71297412+samuelsycamore@users.noreply.github.com>
Co-authored-by: Sam Sycamore <71297412+samuelsycamore@users.noreply.github.com>
Co-authored-by: Sam Sycamore <71297412+samuelsycamore@users.noreply.github.com>
Co-authored-by: Sam Sycamore <71297412+samuelsycamore@users.noreply.github.com>
Co-authored-by: Sam Sycamore <71297412+samuelsycamore@users.noreply.github.com>
Co-authored-by: Sam Sycamore <71297412+samuelsycamore@users.noreply.github.com>
Co-authored-by: Sam Sycamore <71297412+samuelsycamore@users.noreply.github.com>
Co-authored-by: Sam Sycamore <71297412+samuelsycamore@users.noreply.github.com>
Co-authored-by: Sam Sycamore <71297412+samuelsycamore@users.noreply.github.com>
Co-authored-by: Sam Sycamore <71297412+samuelsycamore@users.noreply.github.com>
@mnajdova
Copy link
Member Author

@samuelsycamore @danilo-leal can we do a final review here?


## Nested modal

> ⚠ **Note:** though it is possible to create nested modals—for example, a select modal within a dialog—stacking more than two at a time is discouraged.
Copy link
Contributor

Choose a reason for hiding this comment

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

stacking more than two at a time is discouraged.

Why? 😬

Copy link
Member Author

Choose a reason for hiding this comment

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

Because they block the interaction with the elements behind them. If there are four stacked modals, and you want to go to back to the second one, you need to close two modals and make the interaction you did previously to get to the same state.

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
> **Note:** though it is possible to create nested modals—for example, a select modal within a dialog—stacking more than two at a time is discouraged.
> **Note:** though it is possible to create nested modals—for example, a select modal within a dialog—stacking more than two at a time is discouraged. The main reason is because they block the interaction of elements behind them. If you stack too many, it will be needed to close all of them in order to get to the root state.

Nice! Tried to add the reasoning somehow to this note—feel like it's very worth it. Let me know what you and @samuelsycamore think! May need a bit of tweaking to get the words right.

@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Mar 21, 2022
mnajdova and others added 2 commits March 23, 2022 09:20
Co-authored-by: Sam Sycamore <71297412+samuelsycamore@users.noreply.github.com>
Co-authored-by: danilo leal <67129314+danilo-leal@users.noreply.github.com>
@mnajdova mnajdova added the on hold There is a blocker, we need to wait label Mar 23, 2022
@mnajdova
Copy link
Member Author

I am putting this on hold, will resume once #31923 is merged.

@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Mar 24, 2022
@mnajdova mnajdova added package: base-ui Specific to @mui/base and removed on hold There is a blocker, we need to wait labels Mar 24, 2022
@mnajdova
Copy link
Member Author

This is ready for final review :)

@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Mar 24, 2022
Comment on lines 25 to 30
pathname: '/base/components/utils',
subheader: 'utils',
children: [{ pathname: '/base/react-click-away-listener', title: 'Click-away listener' }],
children: [
{ pathname: '/base/react-click-away-listener', title: 'Click-away listener' },
{ pathname: '/base/react-modal', title: 'Modal' },
],
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if it wouldn't make more sense to have the Modal sit within the Feedback sub-category?! I mean, you could think of everything in the Base package as utils, but the modal is ultimately about building feedback sort-of components.

Copy link
Member Author

Choose a reason for hiding this comment

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

Interesting, in my opinion it is consider a util, because it is used for creating other components. You won't even likely as a developer use it directly in your application, you would use it for creating a dialog, alert or popovers etc. Does that makes sense?

Copy link
Contributor

Choose a reason for hiding this comment

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

It does but still, you could think of any Base component as the foundation for more components, so in that sense, Base is essentially used for building other components. Therefore, everything could potentially be seen an util, I guess. ClickAwayListener is a very good example of a pure util but Modal is the foundational component of several others.

I guess that having it under Feedback would also help somehow with discoverability.

Copy link
Member Author

Choose a reason for hiding this comment

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

Alright, let's cc @michaldudak @siriwatknp for an opinion :)

Copy link
Member

Choose a reason for hiding this comment

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

It does but still, you could think of any Base component as the foundation for more components

The difference between Modal and, say, ButtonUnstyled is that you only need to provide styles for ButtonUnstyled and it's good to go. Modal is more of an internal building block.

I guess that having it under Feedback would also help somehow with discoverability.

I don't think we want to "promote" Modal. We generally encourage devs to use Dialog as that's what they usually require (there's even a note in the docs: "If you are creating a modal dialog, you probably want to use the Dialog component rather than directly using Modal")

mnajdova and others added 2 commits March 25, 2022 09:29
Co-authored-by: Sam Sycamore <71297412+samuelsycamore@users.noreply.github.com>
@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Mar 25, 2022
@mnajdova mnajdova merged commit e82084e into mui:master Mar 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Improvements or additions to the documentation package: base-ui Specific to @mui/base
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants