Skip to content

Commit

Permalink
[button] use button widget internally (#145)
Browse files Browse the repository at this point in the history
Co-authored-by: Kevin Papst <[email protected]>
  • Loading branch information
cavasinf and kevinpapst authored May 30, 2023
1 parent 79d35f5 commit ed21fc9
Showing 1 changed file with 25 additions and 20 deletions.
45 changes: 25 additions & 20 deletions templates/components/buttons.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,34 @@
{% endmacro %}

{% macro link_button(label, href, icon, type, size) %}
{% set _size = size|default(null) %}
{% set _type = type|default('primary') %}
<a href="{{ href|default('#') }}" class="btn btn-{{ _type }}{% if _size %} btn-{{ _size }}{% endif %}">
{% if icon %}
{{ tabler_icon(icon, true) }}
{% endif %}
{% if label %}
<span>{{ label }}</span>
{% endif %}
</a>
{% import '@Tabler/components/button.html.twig' as macro %}

{% set _href = href ?? '#' %}
{% set _icon = icon ?? false %}
{% set _type = type ?? 'primary' %}
{% set _size = size ?? null %}

{{ macro.button(_icon, {
title: label,
combined: true,
url: _href,
class: _size ? 'btn-' ~ _size : ''
}, _type) }}
{% endmacro %}

{% macro action_button(label, action, icon, type, size) %}
{% set _size = size|default(null) %}
{% set _type = type|default('primary') %}
<button data-action="{{ action }}" class="btn btn-{{ _type }}{% if _size %} btn-{{ _size }}{% endif %}">
{% if icon %}
{{ tabler_icon(icon, true) }}
{% endif %}
{% if label %}
<span>{{ label }}</span>
{% endif %}
</button>
{% import '@Tabler/components/button.html.twig' as macro %}

{% set _icon = icon ?? false %}
{% set _type = type ?? 'primary' %}
{% set _size = size ?? null %}

{{ macro.button(_icon, {
title: label,
class: _size ? 'btn-' ~ _size : '',
buttonType: 'button',
attr: {'data-action': action}
}, _type) }}
{% endmacro %}

{% macro submit_button(icon, user_values, type) %}
Expand Down

0 comments on commit ed21fc9

Please sign in to comment.