{# # ============================================================================ # ORGANISM: TOOL HEADER # ============================================================================ # # En-tête de la bibliothèque d'un outil : pastille produit, titre, badge, # description, coût médian et actions. # # S'utilise avec {% embed %} pour surcharger le bloc `actions` quand un outil a # plusieurs boutons ; un simple `primaryAction` suffit dans le cas courant. # # ============================================================================ # COMPOSITION (Atomes utilisés) # ============================================================================ # # - _atoms/icon/icon.html.twig # - _atoms/badge/badge.html.twig # - _atoms/button/button.html.twig # # ============================================================================ # PARAMÈTRES # ============================================================================ # # | Paramètre | Type | Défaut | Description | # |---------------|--------|----------|------------------------------------------| # | icon | string | (requis) | Nom d'atome (ex. 'bubul-slidia') | # | title | string | (requis) | Nom de l'outil | # | description | string | null | Phrase de présentation | # | color | object | null | Entrée de tool_color_details | # | badge | object | null | {label, variant} | # | cost | object | null | {value, unit} — coût médian en tokens | # | primaryAction | object | null | {label, href, icon, disabled} | # | class | string | 'mb-8' | Classes du
| # # ============================================================================ # BLOCS # ============================================================================ # # | Bloc | Description | # |---------|-----------------------------------------------------------------| # | actions | Zone de droite. Rend primaryAction par défaut. Le conteneur | # | | n'est pas rendu si le bloc reste vide (ni primaryAction, ni | # | | surcharge). | # # ============================================================================ # EXEMPLES D'UTILISATION # ============================================================================ # # {% embed '_organisms/tool-header/tool-header.html.twig' with { # icon: 'bubul-slidia', title: 'Slidia', color: tool_color_details['slidia'], # description: 'Transformez vos idées en présentations.', # primaryAction: { label: 'Créer une présentation', href: path('app_slidia_new'), icon: 'plus' } # } only %} # {% block actions %} # (plusieurs boutons ici) # {% endblock %} # {% endembed %} # # ============================================================================ #} {% set class = class ?? 'mb-8' %} {% set color = color ?? null %} {% set badge = badge ?? null %} {% set cost = cost ?? null %} {% set description = description ?? null %} {% set primaryAction = primaryAction ?? null %} {#- `data-tour-step` : ancres GÉNÉRIQUES des tutoriels interactifs. Elles vivent sur l'organisme partagé plutôt que dans chaque gabarit d'outil, si bien qu'un tutoriel peut désigner « l'en-tête » ou « l'action principale » sans rien savoir de l'outil. Inertes : aucun style, aucun comportement. Voir docs/tours.md. -#}
{% include '_atoms/icon/icon.html.twig' with { name: icon, size: '3xl', colorPrimary: 'current', colorSecondary: 'current' } only %}

{{ title }}

{% if badge %} {% include '_atoms/badge/badge.html.twig' with { label: badge.label|default(''), variant: badge.variant|default('warning'), customColor: color ? color.primary : null, size: 'sm' } only %} {% endif %}
{% if description %}

{{ description }}

{% endif %} {% if cost and cost.value|default(0) > 0 %} {% endif %}
{% set actionsContent %} {% block actions %} {% if primaryAction %} {% include '_atoms/button/button.html.twig' with { label: primaryAction.label, variant: color ? 'custom-gradient' : 'primary', gradientFrom: color ? color.primary : null, gradientTo: color ? color.secondary : null, size: 'lg', icon: primaryAction.icon|default('plus'), iconSize: 'lg', href: primaryAction.href|default(null), disabled: primaryAction.disabled|default(false), radius: 'lg', class: 'w-full sm:w-auto' } only %} {% endif %} {% endblock %} {% endset %} {% if actionsContent|trim is not empty %}
{{ actionsContent }}
{% endif %}