Skip to content
This repository has been archived by the owner on May 2, 2023. It is now read-only.

Commit

Permalink
feat(button): improve quality, fix leak (#55)
Browse files Browse the repository at this point in the history
This PR removes unnecessary dashes in the button template + it fixes a leak in the includes.

Jira: INNO-1359
  • Loading branch information
yhuard authored and emeryro committed Mar 7, 2019
1 parent 8d2ea6e commit 130f14d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@ exports[`EC - Accordion renders correctly 1`] = `
class="ecl-button__container"
>
<svg
aria-controls="accordion-example"
aria-hidden="true"
class="ecl-icon ecl-icon--s ecl-button__icon ecl-button__icon--before"
data-ecl-accordion-toggle="true"
focusable="false"
>
<use
Expand Down Expand Up @@ -61,10 +59,8 @@ exports[`EC - Accordion renders correctly 1`] = `
class="ecl-button__container"
>
<svg
aria-controls="accordion-example2"
aria-hidden="true"
class="ecl-icon ecl-icon--s ecl-button__icon ecl-button__icon--before"
data-ecl-accordion-toggle="true"
focusable="false"
>
<use
Expand Down Expand Up @@ -102,10 +98,8 @@ exports[`EC - Accordion renders correctly 1`] = `
class="ecl-button__container"
>
<svg
aria-controls="accordion-example3"
aria-hidden="true"
class="ecl-icon ecl-icon--s ecl-button__icon ecl-button__icon--before"
data-ecl-accordion-toggle="true"
focusable="false"
>
<use
Expand Down
20 changes: 13 additions & 7 deletions src/ec/packages/ec-component-button/button.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,19 @@

<button class="{{ _css_class }}" type="{{ _type }}"{{ _extra_attributes|raw }}>
<span class="ecl-button__container">
{%- if _icon.name is not empty and _icon_position == 'before' -%}
{%- include '../ec-component-icon/icon.html.twig' with { icon: _icon, extra_classes: 'ecl-button__icon ecl-button__icon--before' } -%}
{%- endif -%}
<span class="ecl-button__label" data-ecl-label> {% block label _label %} </span>
{%- if _icon.name is not empty and _icon_position == 'after' -%}
{%- include '../ec-component-icon/icon.html.twig' with { icon: _icon, extra_classes: 'ecl-button__icon ecl-button__icon--after' } -%}
{%- endif -%}
{% if _icon.name is not empty and _icon_position == 'before' %}
{% include '../ec-component-icon/icon.html.twig' with {
icon: _icon,
extra_classes: 'ecl-button__icon ecl-button__icon--before'
} only %}
{% endif %}
<span class="ecl-button__label" data-ecl-label>{% block label _label %}</span>
{% if _icon.name is not empty and _icon_position == 'after' %}
{% include '../ec-component-icon/icon.html.twig' with {
icon: _icon,
extra_classes: 'ecl-button__icon ecl-button__icon--after'
} only %}
{% endif %}
</span>
</button>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,8 @@ exports[`EC - Expandable renders correctly 1`] = `
Collapsed button
</span>
<svg
aria-controls="expandable-example-content"
aria-hidden="true"
class="ecl-icon ecl-icon--fluid ecl-icon--rotate-180 ecl-button__icon ecl-button__icon--after"
data-ecl-expandable-toggle="true"
data-ecl-label-collapsed="Collapsed button"
data-ecl-label-expanded="Expanded button"
focusable="false"
>
<use
Expand Down Expand Up @@ -75,13 +71,8 @@ exports[`EC - Expandable renders correctly when expanded 1`] = `
Collapsed button
</span>
<svg
aria-controls="expandable-example-content"
aria-expanded="true"
aria-hidden="true"
class="ecl-icon ecl-icon--fluid ecl-icon--rotate-180 ecl-button__icon ecl-button__icon--after"
data-ecl-expandable-toggle="true"
data-ecl-label-collapsed="Collapsed button"
data-ecl-label-expanded="Expanded button"
focusable="false"
>
<use
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ exports[`EC - File With translation renders correctly 1`] = `
<svg
aria-hidden="true"
class="ecl-icon ecl-icon--fluid ecl-icon--rotate-180 ecl-button__icon ecl-button__icon--after"
data-ecl-file-translation-toggle=""
focusable="false"
>
<use
Expand Down

0 comments on commit 130f14d

Please sign in to comment.