- Create auth_form_errors.templ: FieldError and GeneralError primitives - Create auth_signup.templ: SignupPage (full) and SignupFormFragment (HTMX swap target) - Define SignupForm and SignupErrors types in templates/auth_forms.go - Add three smoke tests: renders form, renders errors, does not echo password
19 lines
543 B
Text
19 lines
543 B
Text
package templates
|
|
|
|
// FieldError renders a small red error message beneath a form field.
|
|
// Renders nothing when msg is empty so callers can unconditionally include it.
|
|
templ FieldError(msg string) {
|
|
if msg != "" {
|
|
<p class="mt-1 text-sm text-red-700">{ msg }</p>
|
|
}
|
|
}
|
|
|
|
// GeneralError renders a full-width error banner above the form.
|
|
// Renders nothing when msg is empty.
|
|
templ GeneralError(msg string) {
|
|
if msg != "" {
|
|
<div class="mb-4 rounded border border-red-300 bg-red-50 px-4 py-3 text-sm text-red-800">
|
|
{ msg }
|
|
</div>
|
|
}
|
|
}
|