Skip to content

Commit

Permalink
Fix(web-twig): Bugfix boolean props value
Browse files Browse the repository at this point in the history
  • Loading branch information
janicekt authored and literat committed Jul 30, 2022
1 parent f557e02 commit 342760a
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 15 deletions.
6 changes: 3 additions & 3 deletions packages/web-twig/src/Resources/components/button.twig
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{% set _className = _spiritClassPrefix ~ 'Button' %}
{% set _color = (props.color is defined) ? ' ' ~ _className ~ '--' ~ props.color : ' ' ~ _className ~ '--primary' %}
{% set _block = (props.isBlock is defined) ? ' ' ~ _className ~ '--block' : '' %}
{% set _square = (props.isSquare is defined) ? ' ' ~ _className ~ '--square' : '' %}
{% set _block = props.isBlock == 'true' ? ' ' ~ _className ~ '--block' : '' %}
{% set _square = props.isSquare == 'true' ? ' ' ~ _className ~ '--square' : '' %}
{% set _type = (props.type is defined) ? props.type : 'button' %}
{% set _disabled = (props.isDisabled is defined) ? ' disabled="true"' : '' %}
{% set _disabled = props.isDisabled == 'true' ? ' disabled="true"' : '' %}
{% set _ariaLabel = (props.ariaLabel is defined) ? ' aria-label="' ~ props.ariaLabel ~ '"' : '' %}
{% set _onClick = (props.onClick is defined) ? ' onclick="' ~ props.onClick ~'"' : '' %}
{% set _class = (props.class is defined) ? ' ' ~ props.class : '' -%}
Expand Down
6 changes: 3 additions & 3 deletions packages/web-twig/src/Resources/components/buttonLink.twig
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{% set _className = _spiritClassPrefix ~ 'Button' %}
{% set _color = (props.color is defined) ? ' ' ~ _className ~ '--' ~ props.color : ' ' ~ _className ~ '--primary' %}
{% set _block = (props.isBlock is defined) ? ' ' ~ _className ~ '--block' : '' %}
{% set _square = (props.isSquare is defined) ? ' ' ~ _className ~ '--square' : '' %}
{% set _block = (props.isBlock == 'true' ) ? ' ' ~ _className ~ '--block' : '' %}
{% set _square = (props.isSquare == 'true' ) ? ' ' ~ _className ~ '--square' : '' %}
{% set _href = (props.href is defined) ? props.href : '#' %}
{% set _target = (props.target is defined) ? ' target="' ~ props.target ~ '"' : '' %}
{% set _disabledClass = (props.isDisabled is defined) ? ' ' ~ _className ~ '--disabled' : '' %}
{% set _disabledClass = (props.isDisabled == 'true') ? ' ' ~ _className ~ '--disabled' : '' %}
{% set _ariaLabel = (props.ariaLabel is defined) ? ' aria-label="' ~ props.ariaLabel ~ '"' : '' %}
{% set _onClick = (props.onClick is defined) ? ' onclick="' ~ props.onClick ~'"' : '' %}
{% set _class = (props.class is defined) ? ' ' ~ props.class : '' -%}
Expand Down
10 changes: 5 additions & 5 deletions packages/web-twig/src/Resources/components/checkboxField.twig
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
{% set _label = (props.label is defined) ? props.label : '' %}
{% set _labelClass = _className ~ '__label' %}
{% set _labelClassRequired = (props.label is defined) ? ' ' ~ _labelClass ~ '--required' : '' %}
{% set _labelClassHidden = (props.isLabelHidden is defined) ? ' ' ~ _labelClass ~ '--hidden' : '' %}
{% set _labelClassHidden = (props.isLabelHidden == 'true') ? ' ' ~ _labelClass ~ '--hidden' : '' %}

{% set _inputName = (props.name is defined) ? props.name : '' %}
{% set _type = (props.type is defined) ? props.type : 'text' %}
{% set _InputClass = _className ~ '__input' %}

{% set _disabled = (props.isDisabled is defined) ? ' disabled="true"' : '' %}
{% set _checked = (props.isChecked is defined) ? ' checked="checked"' : '' %}
{% set _required = (props.isRequired is defined) ? ' required="true"' : '' %}
{% set _disabledClass = (props.isDisabled is defined) ? ' ' ~ _className ~ '--disabled' : '' %}
{% set _disabled = (props.isDisabled == 'true') ? ' disabled="true"' : '' %}
{% set _checked = (props.isChecked == 'true') ? ' checked="checked"' : '' %}
{% set _required = (props.isRequired == 'true') ? ' required="true"' : '' %}
{% set _disabledClass = (props.isDisabled == 'true') ? ' ' ~ _className ~ '--disabled' : '' %}
{% set _validationStateClass = (props.validationState is defined) ? ' ' ~ _className ~ '--' ~ props.validationState : '' %}
{% set _value = (props.value is defined) ? props.value : '' %}
{% set _class = (props.class is defined) ? ' ' ~ props.class : '' -%}
Expand Down
8 changes: 4 additions & 4 deletions packages/web-twig/src/Resources/components/textField.twig
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
{% set _label = (props.label is defined) ? props.label : '' %}
{% set _labelClass = _className ~ '__label' %}
{% set _labelClassRequired = (props.label is defined) ? ' ' ~ _labelClass ~ '--required' : '' %}
{% set _labelClassHidden = (props.isLabelHidden is defined) ? ' ' ~ _labelClass ~ '--hidden' : '' %}
{% set _labelClassHidden = (props.isLabelHidden == 'true') ? ' ' ~ _labelClass ~ '--hidden' : '' %}

{% set _inputName = (props.name is defined) ? props.name : '' %}
{% set _type = (props.type is defined) ? props.type : 'text' %}
{% set _InputClass = _className ~ '__input' %}

{% set _disabled = (props.isDisabled is defined) ? ' disabled="true"' : '' %}
{% set _required = (props.isRequired is defined) ? ' required="true"' : '' %}
{% set _disabledClass = (props.isDisabled is defined) ? ' ' ~ _className ~ '--disabled' : '' %}
{% set _disabled = (props.isDisabled == 'true') ? ' disabled="true"' : '' %}
{% set _required = (props.isRequired == 'true') ? ' required="true"' : '' %}
{% set _disabledClass = (props.isDisabled == 'true') ? ' ' ~ _className ~ '--disabled' : '' %}
{% set _validationStateClass = (props.validationState is defined) ? ' ' ~ _className ~ '--' ~ props.validationState : '' %}
{% set _placeholder = (props.placeholder is defined) ? ' placeholder="' ~ props.placeholder ~ '"' : '' %}
{% set _value = (props.value is defined) ? props.value : '' %}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html><body>
<button class="Button Button--primary" type="button" disabled>Disabled button</button>
</body></html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html><body>
<button class="Button Button--primary" type="button">Not Disabled button</button>
</body></html>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<Button color="primary" isDisabled>Disabled button</Button>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<Button color="primary" isDisabled=false>Not Disabled button</Button>

0 comments on commit 342760a

Please sign in to comment.