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

[changed] use object className and overlayClassName prop to override … #330

Merged
merged 1 commit into from
May 14, 2017
Merged

Conversation

nikmilson
Copy link
Contributor

Changes proposed:

  • use object className and overlayClassName prop to override the default content and overlay classes;
  • use bodyOpenClassName to override body class name when modal opened.

Upgrade Path (for changed or removed APIs):
For overriding default content and overlay classes you can pass object
with three required properties: base, afterOpen, beforeClose.

<Modal
  ...
  className={{
    base: 'myClass',
    afterOpen: 'myClass_after-open',
    beforeClose: 'myClass_before-close'
  }}
  overlayClassName={{
    base: 'myOverlayClass',
    afterOpen: 'myOverlayClass_after-open',
    beforeClose: 'myOverlayClass_before-close'
  }}
  ...
>

Old behavior is saved, when passed a string.

Acceptance Checklist:

  • All commits have been squashed to one.
  • The commit message follows the guidelines in CONTRIBUTING.md.
  • Documentation (README.md) and examples have been updated as needed.
  • If this is a code change, a spec testing the functionality has been added.
  • If the commit message has [changed] or [removed], there is an upgrade path above.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.5%) to 81.185% when pulling 9719ff5 on cassln:master into a8b7aa0 on reactjs:master.

@diasbruno
Copy link
Collaborator

diasbruno commented Feb 26, 2017

hey @cassln, this PR looks good, but why would you want to replace the class names?
what if we could have something like this:

sass or less style (replace react-modal-* with the actual classes, sorry for been lazy :)).

.{my-class}.react-modal-base { ... }
.{my-class}.react-modal {
  .react-modal-overlay { ... }
  .react-modal-content { ... }
}

@nikmilson
Copy link
Contributor Author

nikmilson commented Feb 27, 2017

Hey @diasbruno. I want to replace the class names because of I'm sticking BEM notation. And cascades like .{my-class}.react-modal-base { ... } are working, but it is wrong for BEM.

Also, this feature makes possible getting clean markup for react-modal in result. :)

@nikmilson
Copy link
Contributor Author

What about merge the feature? :) I really need this in working project.

@diasbruno
Copy link
Collaborator

@cassln don't wait, use it from your fork. :)

@diasbruno
Copy link
Collaborator

diasbruno commented Mar 1, 2017

Be patient. I do think this PR is good. there is some work going on to get a version in between 1.6.5 and 2.0.

base: PropTypes.string.isRequired,
afterOpen: PropTypes.string.isRequired,
beforeClose: PropTypes.string.isRequired
})
Copy link
Collaborator

Choose a reason for hiding this comment

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

It seems that only the base of the classes change. Maybe we can short this changes by keeping the suffixes unchanged like {ReactModal}_before-open and {ReactModal}_after-open. Any thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The suffixes are not flexible. There are BEM alternative naming schemes. The suffixes make impossible of using them. Also, we can pass props like this (without BEM example):

{
  base: 'modal',
  afterOpen: 'open',
  beforeClose: 'close'
}

@nikmilson
Copy link
Contributor Author

there is some work going on to get a version in between 1.6.5 and 2.0

Do you have ability to release version between 1.6.5 and 2.0. This It would be very helpful. 👍

@claydiffrient
Copy link
Contributor

@cassln 1.7.0, 1.7.1, and 1.7.2 have been released.

…the default content and overlay classes;

use bodyOpenClassName to override body class name when modal opened
@nikmilson
Copy link
Contributor Author

The branch has been rebased.

@viniciusffj
Copy link

@cassln @diasbruno Is there a chance to this get merged? I really need the bodyOpenClassName funcionality

@diasbruno
Copy link
Collaborator

cc @claydiffrient @cassln

@pamelipluas
Copy link

@cassln @diasbruno Hi everyone! Any update about this pl? In my project we are using this lib and we really need can change the body classname

@abdennour
Copy link

abdennour commented May 14, 2017

Why this PR is not merged yet ?

@claydiffrient claydiffrient merged commit 6442387 into reactjs:master May 14, 2017
diasbruno added a commit to diasbruno/react-modal that referenced this pull request Jun 11, 2017
This is a backport of @cassln's feature to version 1.8.x.

Original PR is reactjs#330.

reactjs#330
diasbruno added a commit to diasbruno/react-modal that referenced this pull request Jun 11, 2017
This is a backport of @cassln's feature to version 1.8.x.

Original PR is reactjs#330.

reactjs#330
diasbruno added a commit to diasbruno/react-modal that referenced this pull request Jun 12, 2017
This is a backport of @cassln's feature to version 1.8.x.

Original PR is reactjs#330.

reactjs#330
diasbruno added a commit to diasbruno/react-modal that referenced this pull request Jun 12, 2017
This is a backport of @cassln's feature to version 1.8.x.

Original PR is reactjs#330.

reactjs#330
diasbruno added a commit that referenced this pull request Jun 12, 2017
This is a backport of @cassln's feature to version 1.8.x.

Original PR is #330.

#330
techwizard210 pushed a commit to techwizard210/react-modal that referenced this pull request Aug 28, 2022
This is a backport of @cassln's feature to version 1.8.x.

Original PR is #330.

reactjs/react-modal#330
Happypower1103 added a commit to Happypower1103/react-modal that referenced this pull request May 12, 2023
This is a backport of @cassln's feature to version 1.8.x.

Original PR is #330.

reactjs/react-modal#330
DevStar1016 added a commit to DevStar1016/react_modal that referenced this pull request Sep 11, 2023
This is a backport of @cassln's feature to version 1.8.x.

Original PR is #330.

reactjs/react-modal#330
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants