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
Allow adding custom classes to header, content, footer, etc. #1441
Conversation
Pull Request Test Coverage Report for Build 4700
💛 - Coveralls |
61de64d
to
eb660bb
Compare
eb660bb
to
c0212a9
Compare
2875b44
to
6807b15
Compare
6807b15
to
bc0675e
Compare
@gverni the PR is ready for review 🚀 |
Thanks @limonte, i'm on it... |
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.
Also, what's the rationale behind leaving confirmButtonClass
, cancelButtonClass
, imageClass
out of customClass
? Shouldn't they be added as well?
@@ -377,6 +377,9 @@ export function _main (userParams) { | |||
if (innerParams.inputClass) { | |||
dom.addClass(inputContainer, innerParams.inputClass) | |||
} | |||
if (innerParams.customClass) { |
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.
For performance reasons, this should be:
if (innerParams.customClass.input)
If you set a breakpoint inside the if
you will see that is called 5 times (one for each input types) even if customClass.input
it's undefined. I think we should avoid that...
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.
@@ -452,12 +464,30 @@ declare module 'sweetalert2' { | |||
|
|||
/** | |||
* A custom CSS class for the modal. | |||
* If a string value is provided, the classname will be applied to the popup. |
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.
It works also with an array of strings. Do you want to add that?
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.
bc0675e
to
9c94f1d
Compare
Good point! Done. |
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.
Apart for a small change (sorry again!!) looks good to me @limonte!
9c94f1d
to
d6be236
Compare
Thanks @limonte, for me it's good now. I'll create some more example at https://github.com/sweetalert2/sweetalert2-examples and update the side bar one. |
🎉 This PR is included in version 8.3.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Closes #1440
(API docs sweetalert2/sweetalert2.github.io#65)
Also,
customContainerClass
,confirmButtonClass
,cancelButtonClass
,imageClass
,inputClass
are deprecated (sweetalert2/sweetalert2.github.io#66)Alos, expose
Swal.getHeader()
(API docs sweetalert2/sweetalert2.github.io#64)Also, in scope of this PR there's a small improvement of the deprecation warning:
Before:
After: