{#
Bouton unifié. Remplace : button-primary, context-primary-action,
project-context-secondary, my-workload-add-slot, milestone-inspector__save,
context-icon-button, table-action…
Paramètres : label, variant (primary|secondary|ghost|danger|icon),
size (md|sm), href, type, name, value, disabled, icon (nom Material Symbol).
Usage :
{{ include('components/button.html.twig', { label: 'Enregistrer' }) }}
{{ include('components/button.html.twig', { label: 'Filtrer', variant: 'primary', type: 'submit', icon: 'filter_alt' }) }}
{{ include('components/button.html.twig', { label: 'Supprimer', variant: 'danger', name: 'action', value: 'delete' }) }}
{{ include('components/button.html.twig', { label: 'Retour', variant: 'ghost', href: path('app_dashboard') }) }}
#}
{%- set variant = variant|default('primary') -%}
{%- set size = size|default('md') -%}
{%- set classes = 'c-btn c-btn--' ~ variant ~ (size == 'sm' ? ' c-btn--sm' : '') -%}
{%- set inner %}{% if icon is defined and icon %}{{ icon }}{% endif %}{{ label|default('') }}{% endset -%}
{%- set onclick = (confirm is defined and confirm) ? 'return confirm(\'' ~ confirm|e('js') ~ '\')' : null -%}
{%- if href is defined and href -%}
{{ inner }}
{%- else -%}
{%- endif -%}