Comments (4)
Hi @limonte,
I'll work on a PR this week. Finally found the time. I'll probably have some questions but hopefully not many.
One question that doesn't seem possible, can a theme define default JS settings? For example, the default animation class if none is set (WordPress fades in from the bottom).
I'll share some code here as well in case someone ends up here looking how to make it look right inside WordPress. For the offset question above, it looks like I will use something like this (the left nav panel can be dynamic, so it should calculate each time):
this.notify = Swal.mixin({
toast: true,
position: 'rtl' === document.dir ? 'bottom-end' : 'bottom-start',
showConfirmButton: false,
timer: 3000,
onBeforeOpen: (toast) => {
// Offset the toast message based on the admin menu width
let dir = 'rtl' === document.dir ? 'right' : 'left'
toast.parentElement.style[dir] = document.getElementById('adminmenu').offsetWidth + 'px'
}
})
from sweetalert2-themes.
I'll work on a PR this week. Finally found the time. I'll probably have some questions but hopefully not many.
I'm here to answer any of your questions!
One question that doesn't seem possible, can a theme define default JS settings? For example, the default animation class if none is set (WordPress fades in from the bottom).
Yes, just redefine $swal2-show-animation
and $swal2-hide-animation
variables, we did the same in Bootstrap theme: https://github.com/sweetalert2/sweetalert2-themes/blob/master/bootstrap-4/bootstrap-4.scss#L169
You can find the list of all SCSS vriables here: https://github.com/sweetalert2/sweetalert2/blob/master/src/variables.scss
For the offset question above, it looks like I will use something like this (the left nav panel can be dynamic, so it should calculate each time):
Yup, exactly. Except this line isn't needed:
position: 'rtl' === document.dir ? 'bottom-end' : 'bottom-start',
start
and end
are handled with the document direction in mind.
from sweetalert2-themes.
Hey @KevinBatdorf and thank you for opening this request!
WordPress has toast style notifications now that might be a useful theme to some. I can probably work on this if there is interest.
Totally agree. It looks quite similar to the existing Dark theme, take a look at its implementation: https://github.com/sweetalert2/sweetalert2-themes/blob/master/dark/dark.scss
Here's how to start a new theme: https://github.com/sweetalert2/sweetalert2-themes#contributing
Let me know if you're willing to send a PR.
Also, is it possible to provide a dynamic offset like in this photo?
This can be achieved by using customClass
with a class with desired margins, something like this:
Swal.fire({
...
position: 'bottom-left',
customClass: {
container: 'offset-left'
}
})
.offset-left {
margn-left: 200px;
}
from sweetalert2-themes.
🎉 This issue has been resolved in version 3.1.0 🎉
The release is available on:
Your semantic-release bot 📦🚀
from sweetalert2-themes.
Related Issues (20)
- Dark theme doesn't work in angular HOT 2
- Dependency Dashboard
- success icon is bugged (dark mode theme) HOT 1
- [Feature Request] Nord theme.
- How to add an image with sweetalert2 working in a Next.js project?
- It doesn't have any effect in ViteJS project HOT 2
- This theming still up to date? HOT 1
- dark theme for material ui
- How to use themes HOT 2
- Bootstrap 4 Theme CSS Values alignment HOT 1
- Bootstrap 5 Theme HOT 6
- Do not use tilde ~ HOT 1
- SassError because of node_modules/ HOT 2
- Themes in NextJS doesn't work HOT 5
- Deprecation Warning
- Using themes HOT 1
- Showing a SweetAlert in fullscreen HOT 2
- Using themes
- Using themes
- Using themes HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sweetalert2-themes.