Feat: Improve checkbox styles

This commit is contained in:
Björn Fromme
2023-10-12 10:58:53 +02:00
parent f991c3585a
commit c0bb7d8ead
+5 -4
View File
@@ -68,11 +68,11 @@
{%- endblock textarea_widget -%} {%- endblock textarea_widget -%}
{%- block checkbox_widget -%} {%- block checkbox_widget -%}
{%- set attr = attr|merge({'class': (attr.class|default('') ~ ' h-4 w-4 rounded border-gray-300 text-primary')|trim }) -%} {%- set attr = attr|merge({'class': (attr.class|default('') ~ ' h-4 w-4 rounded text-primary')|trim }) -%}
{%- if errors|length -%} {%- if errors|length -%}
{%- set attr = attr|merge({'class': attr.class|default('') ~ ' ring-red-500 focus:ring-red-500' }) -%} {%- set attr = attr|merge({'class': attr.class|default('') ~ ' border-red-500 text-red-500 ring-red-500 focus:ring-red-500' }) -%}
{% else %} {% else %}
{%- set attr = attr|merge({'class': attr.class|default('') ~ ' focus:ring-primary' }) -%} {%- set attr = attr|merge({'class': attr.class|default('') ~ ' border-gray-300 focus:ring-primary' }) -%}
{%- endif -%} {%- endif -%}
{%- if attr.disabled is defined and attr.disabled == true -%} {%- if attr.disabled is defined and attr.disabled == true -%}
{%- set attr = attr|merge({'class': attr.class|default('') ~ ' cursor-not-allowed' }) -%} {%- set attr = attr|merge({'class': attr.class|default('') ~ ' cursor-not-allowed' }) -%}
@@ -85,10 +85,11 @@
<div class="flex h-6 items-center"> <div class="flex h-6 items-center">
{{ form_widget(form) }} {{ form_widget(form) }}
</div> </div>
<div class="ml-3 leading-6"> <div class="{{ html_classes('ml-3 leading-6', { 'text-red-500': errors|length }) }}">
<label for="{{ form.vars.id }}"> <label for="{{ form.vars.id }}">
{{ form.vars.label }} {{ form.vars.label }}
</label> </label>
{{- form_errors(form) -}}
</div> </div>
</div> </div>
{% endblock %} {% endblock %}