fix: use a darker red for form errors

This commit is contained in:
fromme committed 2026-11-12 11:36:07 +01:00
1 parent 852bffb073
commit 6b16c88a5b
1 file changed
+17 -17
+17 -17
View File
@@ -16,7 +16,7 @@
{%- block form_label -%}
{% set class = 'block font-bold pb-2' %}
{% if errors|length %}
{% set class = class ~ ' text-red-500' %}
{% set class = class ~ ' text-red-700' %}
{% endif %}
{% set label_attr = label_attr|merge({'class': (label_attr.class|default('') ~ class)|trim}) %}
{{ parent() }}
@@ -26,7 +26,7 @@
{%- if errors|length > 0 -%}
<ul class="pb-2">
{%- for error in errors -%}
<li class="text-red-500">{{ error.message }}</li>
<li class="text-red-700">{{ error.message }}</li>
{%- endfor -%}
</ul>
{%- endif -%}
@@ -43,7 +43,7 @@
{%- if type != 'hidden' -%}
{%- set attr = attr|merge({'class': (attr.class|default('') ~ ' block w-full rounded-md border-0 py-1.5 text-gray-900 ring-1 ring-inset ring-slate-500 focus:ring-2 focus:ring-inset text-sm')|trim }) -%}
{%- if errors|length -%}
{%- set attr = attr|merge({'class': attr.class|default('') ~ ' ring-red-500 placeholder-red-500 focus:ring-red-500' }) -%}
{%- set attr = attr|merge({'class': attr.class|default('') ~ ' ring-red-700 placeholder-red-700 focus:ring-red-700' }) -%}
{% else %}
{%- set attr = attr|merge({'class': attr.class|default('') ~ ' placeholder:text-slate-500 focus:ring-brand-bright' }) -%}
{%- endif -%}
@@ -60,7 +60,7 @@
{%- block textarea_widget -%}
{%- set attr = attr|merge({'class': (attr.class|default('') ~ ' block w-full rounded-md border-0 py-1.5 text-gray-900 ring-1 ring-inset ring-slate-500 focus:ring-2 focus:ring-inset text-sm')|trim }) -%}
{%- if errors|length -%}
{%- set attr = attr|merge({'class': attr.class|default('') ~ ' ring-red-500 placeholder-red-500 focus:ring-red-500' }) -%}
{%- set attr = attr|merge({'class': attr.class|default('') ~ ' ring-red-700 placeholder-red-700 focus:ring-red-700' }) -%}
{% else %}
{%- set attr = attr|merge({'class': attr.class|default('') ~ ' placeholder:text-slate-500 focus:ring-brand-bright' }) -%}
{%- endif -%}
@@ -76,7 +76,7 @@
{%- block checkbox_widget -%}
{%- set attr = attr|merge({'class': (attr.class|default('') ~ ' h-4 w-4 rounded-sm text-primary')|trim }) -%}
{%- if errors|length -%}
{%- set attr = attr|merge({'class': attr.class|default('') ~ ' border-red-500 text-red-500 ring-red-500 focus:ring-red-500' }) -%}
{%- set attr = attr|merge({'class': attr.class|default('') ~ ' border-red-700 text-red-700 ring-red-700 focus:ring-red-700' }) -%}
{% else %}
{%- set attr = attr|merge({'class': attr.class|default('') ~ ' border-gray-300 focus:ring-primary' }) -%}
{%- endif -%}
@@ -91,7 +91,7 @@
<div class="flex h-6 items-center">
{{ form_widget(form) }}
</div>
<div class="{{ html_classes('ml-3 leading-6', { 'text-red-500': errors|length }) }}">
<div class="{{ html_classes('ml-3 leading-6', { 'text-red-700': errors|length }) }}">
<label for="{{ form.vars.id }}">
{{ form.vars.label }}
</label>
@@ -104,7 +104,7 @@
{%- block choice_widget_collapsed -%}
{%- set attr = attr|merge({'class': (attr.class|default('') ~ ' block w-full rounded-md border-0 py-1.5 text-gray-900 ring-1 ring-inset ring-slate-500 focus:ring-2 focus:ring-inset text-sm')|trim }) -%}
{%- if errors|length -%}
{%- set attr = attr|merge({'class': attr.class|default('') ~ ' ring-red-500 placeholder-red-500 focus:ring-red-500' }) -%}
{%- set attr = attr|merge({'class': attr.class|default('') ~ ' ring-red-700 placeholder-red-700 focus:ring-red-700' }) -%}
{% else %}
{%- set attr = attr|merge({'class': attr.class|default('') ~ ' placeholder:text-slate-500 focus:ring-brand-bright' }) -%}
{%- endif -%}
@@ -230,7 +230,7 @@
<div class="flex flex-col gap-y-1" {{ block('widget_container_attributes') }}>
{%- for child in form -%}
<label for="{{ child.vars.id }}"
class="{{ html_classes('flex cursor-pointer select-none items-center gap-x-3 rounded-md px-3 py-2 text-sm ring-1 ring-inset transition-colors hover:bg-gray-100 has-[:checked]:bg-primary/10 has-[:checked]:ring-primary', { 'ring-red-500': errors|length, 'ring-gray-200': not errors|length }) }}">
class="{{ html_classes('flex cursor-pointer select-none items-center gap-x-3 rounded-md px-3 py-2 text-sm ring-1 ring-inset transition-colors hover:bg-gray-100 has-[:checked]:bg-primary/10 has-[:checked]:ring-primary', { 'ring-red-700': errors|length, 'ring-gray-200': not errors|length }) }}">
{{- form_widget(child, { attr: { class: 'h-4 w-4 shrink-0 border-gray-300 text-primary focus:ring-primary' } }) -}}
<span class="text-gray-900">{{ child.vars.label }}</span>
</label>
@@ -244,7 +244,7 @@
{%- for child in form -%}
<label class="cursor-pointer">
{{- form_widget(child, { attr: { class: 'peer sr-only' } }) -}}
<span class="{{ html_classes('flex h-10 w-10 items-center justify-center rounded-md text-sm font-bold ring-1 ring-inset peer-checked:bg-primary peer-checked:text-white peer-checked:ring-primary peer-focus-visible:ring-2', { 'ring-red-500 text-red-500': errors|length, 'ring-gray-300 text-gray-900': not errors|length }) }}">
<span class="{{ html_classes('flex h-10 w-10 items-center justify-center rounded-md text-sm font-bold ring-1 ring-inset peer-checked:bg-primary peer-checked:text-white peer-checked:ring-primary peer-focus-visible:ring-2', { 'ring-red-700 text-red-700': errors|length, 'ring-gray-300 text-gray-900': not errors|length }) }}">
{{- child.vars.label -}}
</span>
</label>
@@ -273,7 +273,7 @@
{%- for child in form -%}
<label class="cursor-pointer">
{{- form_widget(child, { attr: { class: 'peer sr-only' } }) -}}
<span class="{{ html_classes('flex min-w-16 items-center justify-center rounded-md px-3 py-1.5 text-sm ring-1 ring-inset transition-colors hover:bg-gray-100 peer-checked:bg-primary peer-checked:text-white peer-checked:ring-primary peer-focus-visible:ring-2', { 'ring-red-500 text-red-500': errors|length, 'ring-gray-300 text-gray-900': not errors|length }) }}">
<span class="{{ html_classes('flex min-w-16 items-center justify-center rounded-md px-3 py-1.5 text-sm ring-1 ring-inset transition-colors hover:bg-gray-100 peer-checked:bg-primary peer-checked:text-white peer-checked:ring-primary peer-focus-visible:ring-2', { 'ring-red-700 text-red-700': errors|length, 'ring-gray-300 text-gray-900': not errors|length }) }}">
{{- child.vars.label -}}
</span>
</label>
@@ -347,7 +347,7 @@
{%- block questionnaire_pick_toggle -%}
<div class="questionnaire-pick__head {{ head_class|default('') }}">
<label for="{{ form.picked.vars.id }}"
class="{{ html_classes('flex cursor-pointer select-none items-center gap-x-3 rounded-md px-3 py-1.5 text-sm ring-1 ring-inset transition-colors hover:bg-gray-100 has-[:checked]:bg-primary/10 has-[:checked]:ring-primary', { 'ring-red-500': errors|length, 'ring-gray-200': not errors|length }) }}">
class="{{ html_classes('flex cursor-pointer select-none items-center gap-x-3 rounded-md px-3 py-1.5 text-sm ring-1 ring-inset transition-colors hover:bg-gray-100 has-[:checked]:bg-primary/10 has-[:checked]:ring-primary', { 'ring-red-700': errors|length, 'ring-gray-200': not errors|length }) }}">
{{- form_widget(form.picked) -}}
<span class="text-gray-900">{{ form.picked.vars.label }}</span>
</label>
@@ -359,7 +359,7 @@
{%- block questionnaire_pick_number -%}
<label class="flex items-center gap-x-2">
<span class="w-20">{{- form_widget(child) -}}</span>
<span class="{{ html_classes({ 'text-red-500': child.vars.errors|length, 'text-gray-700': not child.vars.errors|length }) }}">{{ child.vars.label }}</span>
<span class="{{ html_classes({ 'text-red-700': child.vars.errors|length, 'text-gray-700': not child.vars.errors|length }) }}">{{ child.vars.label }}</span>
</label>
{%- endblock questionnaire_pick_number -%}
@@ -376,7 +376,7 @@
{%- for child in form -%}
<label class="cursor-pointer">
<input type="checkbox" id="{{ child.vars.id }}" name="{{ child.vars.full_name }}" value="{{ child.vars.value }}" class="peer sr-only"{% if child.vars.checked %} checked="checked"{% endif %}>
<span class="{{ html_classes('flex items-center rounded-md px-2 py-1 text-xs ring-1 ring-inset peer-checked:bg-primary peer-checked:text-white peer-checked:ring-primary peer-focus-visible:ring-2', { 'ring-red-500 text-red-500': errors|length, 'ring-gray-300 text-gray-900': not errors|length }) }}">
<span class="{{ html_classes('flex items-center rounded-md px-2 py-1 text-xs ring-1 ring-inset peer-checked:bg-primary peer-checked:text-white peer-checked:ring-primary peer-focus-visible:ring-2', { 'ring-red-700 text-red-700': errors|length, 'ring-gray-300 text-gray-900': not errors|length }) }}">
{{- child.vars.label -}}
</span>
</label>
@@ -416,7 +416,7 @@
{%- set class = 'flex items-center space-x-1 ' ~ attr.class|default('') -%}
{%- do form.setRendered -%}
{%- if errors|length -%}
{%- set attr = attr|merge({'class': attr.class|default('') ~ ' ring-red-500 placeholder-red-500 focus:ring-red-500' }) -%}
{%- set attr = attr|merge({'class': attr.class|default('') ~ ' ring-red-700 placeholder-red-700 focus:ring-red-700' }) -%}
{%- endif -%}
<div class="{{ class }}">
{{ form_widget(form.month, { 'attr': attr })}}
@@ -428,7 +428,7 @@
{%- block money_widget -%}
{% set currency_class = 'absolute top-1/2 transform -translate-y-1/2 right-0 mr-2' %}
{% if errors|length %}
{% set currency_class = currency_class ~ ' text-red-500' %}
{% set currency_class = currency_class ~ ' text-red-700' %}
{% else %}
{% set currency_class = currency_class ~ ' text-gray-600' %}
{% endif %}
@@ -443,7 +443,7 @@
{%- set maxDate = form.vars.max_date ? form.vars.max_date | date('Y-m-d') : null -%}
{%- set attr = attr|merge({'class': (attr.class|default('') ~ ' block w-full rounded-md border-0 py-1.5 text-gray-900 ring-1 ring-inset ring-slate-500 focus:ring-2 focus:ring-inset text-sm')|trim }) -%}
{%- if errors|length -%}
{%- set attr = attr|merge({'class': attr.class|default('') ~ ' ring-red-500 placeholder:red-500 focus:ring-red-500' }) -%}
{%- set attr = attr|merge({'class': attr.class|default('') ~ ' ring-red-700 placeholder:text-red-700 focus:ring-red-700' }) -%}
{% else %}
{%- set attr = attr|merge({'class': attr.class|default('') ~ ' placeholder:text-gray-900 focus:ring-primary' }) -%}
{%- endif -%}
@@ -461,7 +461,7 @@
{%- block autocomplete_widget -%}
{%- set attr = attr|merge({'class': (attr.class|default('') ~ ' autocomplete-input block w-full rounded-md border-0 py-1.5 text-gray-900 ring-1 ring-inset ring-slate-500 focus:ring-2 focus:ring-inset text-sm')|trim }) -%}
{%- if errors|length -%}
{%- set attr = attr|merge({'class': attr.class|default('') ~ ' ring-red-500 placeholder-red-500 focus:ring-red-500' }) -%}
{%- set attr = attr|merge({'class': attr.class|default('') ~ ' ring-red-700 placeholder-red-700 focus:ring-red-700' }) -%}
{% else %}
{%- set attr = attr|merge({'class': attr.class|default('') ~ ' placeholder:text-slate-500 focus:ring-brand-bright' }) -%}
{%- endif -%}