htmgo/examples/simple-auth/ui/error.go

21 lines
362 B
Go
Raw Normal View History

2024-10-20 12:48:58 +00:00
package ui
import "github.com/maddalax/htmgo/framework/h"
func FormError(error string) *h.Element {
return h.Div(
h.Id("form-error"),
h.Text(error),
h.If(
error != "",
h.Class("p-4 bg-rose-400 text-white rounded"),
),
2024-10-20 12:48:58 +00:00
)
}
func SwapFormError(ctx *h.RequestContext, error string) *h.Partial {
return h.SwapPartial(ctx,
FormError(error),
)
}