34 lines
773 B
Text
34 lines
773 B
Text
|
|
package templates
|
|
|
|
templ Alert(id, alertType, message string, dismissible bool) {
|
|
<div
|
|
id={ id }
|
|
class={ "alert", "alert-" + alertType, templ.KV("alert-dismissible", dismissible), templ.KV("d-none", message == "") }
|
|
role="alert"
|
|
>
|
|
if message != "" {
|
|
{ message }
|
|
}
|
|
if dismissible {
|
|
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
|
}
|
|
</div>
|
|
}
|
|
|
|
// Helper components for common alert types
|
|
templ ErrorAlert(id, message string) {
|
|
@Alert(id, "danger", message, false)
|
|
}
|
|
|
|
templ SuccessAlert(id, message string) {
|
|
@Alert(id, "success", message, true)
|
|
}
|
|
|
|
templ WarningAlert(id, message string) {
|
|
@Alert(id, "warning", message, true)
|
|
}
|
|
|
|
templ InfoAlert(id, message string) {
|
|
@Alert(id, "info", message, true)
|
|
}
|