|
|
@ -1,25 +1,38 @@ |
|
|
|
import { Controller } from "@hotwired/stimulus" |
|
|
|
import Toastify from 'toastify-js' |
|
|
|
|
|
|
|
// Connects to data-controller="flash"
|
|
|
|
export default class extends Controller { |
|
|
|
|
|
|
|
count = 0 |
|
|
|
count = 1 |
|
|
|
|
|
|
|
connect() { |
|
|
|
console.log('FLASH stimulus ready!') |
|
|
|
} |
|
|
|
|
|
|
|
notice() { |
|
|
|
console.warn('show notice') |
|
|
|
const message = `
|
|
|
|
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 shrink-0 stroke-current mx-4" fill="none" viewBox="0 0 24 24"> |
|
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" /> |
|
|
|
</svg> |
|
|
|
<div> |
|
|
|
This <i>is</i> toast #${this.count++} + a long message which should wrap over 2 or more lines.<br/> |
|
|
|
lorem ipsum lorem ipsume lorem ipsum lorem ipsume<br> |
|
|
|
lorem ipsum lorem ipsume |
|
|
|
</div> |
|
|
|
`
|
|
|
|
console.warn(Toastify.defaults.selector) |
|
|
|
console.info(message) |
|
|
|
Toastify({ |
|
|
|
text: `This is toast #${this.count++} + a long message which should wrap over 2 or more lines`, |
|
|
|
selector: 'flash-container', |
|
|
|
text: message, |
|
|
|
escapeMarkup: false, |
|
|
|
className: 'alert alert-success inset-ring-2 shadow-xl/30', |
|
|
|
close: true, |
|
|
|
position: 'center', |
|
|
|
// gravity: "top", // `top` or `bottom`
|
|
|
|
// stopOnFocus: true, // Prevents dismissing of toast on hover
|
|
|
|
// duration: 3000,
|
|
|
|
// duration: 0,
|
|
|
|
offset: { |
|
|
|
// x: 50, // horizontal axis - can be a number or a string indicating unity. eg: '2em'
|
|
|
|
y: 30 // vertical axis - can be a number or a string indicating unity. eg: '2em'
|
|
|
|