Alessio ee2b287fd9 Enable adding toasts in full page reloads (and HTMX where it's hx-boost or target = body)
- use toasts to display non-fatal scraping errors for Tweets
2024-08-18 16:36:32 -07:00

17 lines
528 B
Smarty

{{define "toast"}}
<div
class="toast toast--{{.Type}}"
{{if .AutoCloseDelay}}
hx-on::load="setTimeout(() => this.remove(), {{.AutoCloseDelay}} + 2000); setTimeout(() => this.classList.add('disappearing'), {{.AutoCloseDelay}})"
{{end}}
>
{{if .Title}}
<h2 class="toast__title">{{.Title}}</h2>
{{end}}
<span class="toast__message">{{.Message}}</span>
{{if not .AutoCloseDelay}}
<button class="suicide" onclick="this.parentElement.remove()">X</button>
{{end}}
</div>
{{end}}