-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Add modal using react modal #6375
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only reviewed styling.
components/modal/style.scss
Outdated
@@ -0,0 +1,105 @@ | |||
.edit-post-plugin-modal__editor-modal { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The prefix should be .components-modal
according to the coding standards.
You could use the following structure for better readability:
.components-modal {
&__screen-overlay {}
&__content {}
&__header {}
}
components/modal/style.scss
Outdated
} | ||
} | ||
|
||
@include editor-left('.edit-post-plugin-screen-takeover__editor-screen-takeover-overlay'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
screen takeover reference should be removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
components/modal/style.scss
Outdated
@include editor-left('.edit-post-plugin-screen-takeover__editor-screen-takeover-overlay'); | ||
|
||
// We prevent scrolling of the body when the React Modal screen takeover is opened. | ||
body.ReactModal__Body--open { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use bodyOpenClassName
props to overwrite ReactModal__Body--open
.
While we're on the topic it would be favourable if portalClassName
was also changed to something that is more suitable to WordPress.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
renamed to WordPress-modal for now.
Can you elaborate on how this approach differs from #6261, in more detail than just that it uses |
Are there plans to continue work here, or should this be closed in favor of #6261 ? |
Description
Adds a modal component, making use of react-modal. The contents of the modal, and the opening and closing of the modal, is the responsibility of the implementor. An example of the implementation of this modal can be found in the test section.
An alternative solution to: #6261
How has this been tested?
To test the modal yourself, add the following to layout/index.js:
this one at the top of the file.
And this one somewhere in the return
And create the file modalWrapper.js at components/modal, containing:
Screenshots
Types of changes
New feature
Checklist: