20 lines
543 B
Text
20 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>
|
||
|
|
}
|
||
|
|
}
|