|
1 | 1 | <div class="w-full text-center"> |
2 | | - <button sfx="button" kind="solid" color="primary" class="m-0.5 bttn js-bttn-general">Passive</button> |
3 | | - <button sfx="button" kind="solid" color="primary" class="m-0.5 bttn js-bttn-warn">Confirm</button> |
4 | | - <button sfx="button" kind="solid" color="primary" class="m-0.5 bttn js-bttn-confirm-danger">Confirm Danger</button> |
5 | | - <button sfx="button" kind="solid" color="primary" class="m-0.5 bttn js-bttn-danger">Form</button> |
6 | | - <button sfx="button" kind="solid" color="primary" class="m-0.5 bttn js-bttn-success">Raw Data</button> |
7 | | - <script type="module"> |
8 | | - import { passive, confirm, form, raw } from "/js/modal-maker.js"; |
9 | | - document.body.querySelector(".js-bttn-general").addEventListener("click", () => { |
10 | | - passive({ |
11 | | - heading: "Example Modal", |
12 | | - message: "This is an example passive modal.", |
13 | | - }); |
14 | | - }); |
15 | | - document.body.querySelector(".js-bttn-warn").addEventListener("click", () => { |
16 | | - confirm({ |
17 | | - heading: "Example Modal", |
18 | | - message: "This is an example confirm modal.", |
19 | | - }) |
20 | | - .then(() => { |
21 | | - console.log("Confirmed"); |
22 | | - }) |
23 | | - .catch(() => { |
24 | | - console.log("Canceled"); |
25 | | - }); |
26 | | - }); |
27 | | - document.body.querySelector(".js-bttn-confirm-danger").addEventListener("click", () => { |
28 | | - confirm({ |
29 | | - heading: "Example Modal", |
30 | | - message: "This is an example danger confirm modal.", |
31 | | - dangerous: true, |
32 | | - confirmLabel: "delete account", |
33 | | - size: "medium", |
34 | | - }) |
35 | | - .then(() => { |
36 | | - console.log("Confirmed"); |
37 | | - }) |
38 | | - .catch(() => { |
39 | | - console.log("Canceled"); |
40 | | - }); |
41 | | - }); |
42 | | - document.body.querySelector(".js-bttn-danger").addEventListener("click", () => { |
43 | | - const formEl = document.createElement("form"); |
44 | | - formEl.innerHTML = `<input type="text" placeholder="Your name" name="fullName">`; |
45 | | - form({ |
46 | | - form: formEl, |
47 | | - }) |
48 | | - .then((data) => { |
49 | | - console.log(data.get("fullName")); |
50 | | - }) |
51 | | - .catch(() => { |
52 | | - console.log("Form rejected"); |
53 | | - }); |
54 | | - }); |
55 | | - document.body.querySelector(".js-bttn-success").addEventListener("click", () => { |
56 | | - raw({ |
57 | | - heading: "Waffles", |
58 | | - message: "They're better than pancakes. Don't @ me.", |
59 | | - el: `<img class="w-full ar-16:9" src="https://images.unsplash.com/photo-1616709620730-0058222c8389?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=600&q=80" alt="waffles on white ceramic plate">`, |
60 | | - size: "large", |
61 | | - }); |
62 | | - }); |
63 | | - </script> |
| 2 | + <button sfx="button" kind="solid" color="grey" class="m-0.5 bttn js-bttn-general">Passive</button> |
| 3 | + <button sfx="button" kind="solid" color="grey" class="m-0.5 bttn js-bttn-warn">Confirm</button> |
| 4 | + <button sfx="button" kind="solid" color="grey" class="m-0.5 bttn js-bttn-confirm-danger">Confirm Danger</button> |
| 5 | + <button sfx="button" kind="solid" color="grey" class="m-0.5 bttn js-bttn-danger">General Actions</button> |
| 6 | + <script type="module"></script> |
64 | 7 | </div> |
65 | | -<link href="/css/modals.css" rel="stylesheet" /> |
66 | 8 | <link href="/css/button.css" rel="stylesheet" /> |
0 commit comments