diff options
| author | Xe Iaso <me@xeiaso.net> | 2024-04-21 15:29:27 -0400 |
|---|---|---|
| committer | Xe Iaso <me@xeiaso.net> | 2024-04-21 15:29:27 -0400 |
| commit | c55abbb0e9282833db5e73bbf3ed16977e4f2b87 (patch) | |
| tree | 15e60ae8efad5cb4b72c02255e9dba9162e72407 | |
| parent | ccd20508c9c750304c7d454020b72257804eb37c (diff) | |
| download | xesite-c55abbb0e9282833db5e73bbf3ed16977e4f2b87.tar.xz xesite-c55abbb0e9282833db5e73bbf3ed16977e4f2b87.zip | |
use sweetalert for cases when you can't share directly with a native share sheet
Signed-off-by: Xe Iaso <me@xeiaso.net>
| -rw-r--r-- | lume/src/_includes/blog.njk | 6 | ||||
| -rw-r--r-- | lume/src/js/swal.js | 3 |
2 files changed, 8 insertions, 1 deletions
diff --git a/lume/src/_includes/blog.njk b/lume/src/_includes/blog.njk index 9e8d625..07f3b6d 100644 --- a/lume/src/_includes/blog.njk +++ b/lume/src/_includes/blog.njk @@ -38,7 +38,9 @@ layout: base.njk </svg> </button> - <script> + <script type="module"> + import swal from "/js/swal.js"; + const shareButton = document.getElementById("shareButton"); function doShareButton() { const shareData = { @@ -62,8 +64,10 @@ layout: base.njk console.log("Thanks for sharing!"); }) .catch(console.error); + swal("Link copied to clipboard", "Feel free to paste it anywhere you like!", "success"); } else { console.log("can't share directly, but feel free to copy the url from addressbar manually"); + swal("Can't share directly", "Feel free to copy the url from addressbar manually!", "info"); } } shareButton.addEventListener("click", doShareButton); diff --git a/lume/src/js/swal.js b/lume/src/js/swal.js new file mode 100644 index 0000000..1ee8022 --- /dev/null +++ b/lume/src/js/swal.js @@ -0,0 +1,3 @@ +import swal from "npm:sweetalert"; + +export default swal;
\ No newline at end of file |
