-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat(web-twig): Optimize navbarToggle component & allow aria-* mainPr…
…ops and ignore empty string (DS-161)
- Loading branch information
Showing
10 changed files
with
39 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 3 additions & 9 deletions
12
packages/web-twig/src/Resources/components/navbarToggle.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,11 @@ | ||
{% set _className = _spiritClassPrefix ~ 'Header__toggle' %} | ||
{% set _iconClassName = _spiritClassPrefix ~ 'Header__icon' %} | ||
{% set _class = (props.class is defined) ? ' ' ~ props.class : '' %} | ||
{% set _label = (props.label is defined) ? props.label : 'Menu' %} | ||
{% set _ariaControls = (props.ariaControls is defined) ? ' aria-controls="' ~ props.ariaControls ~ '"' : '' %} | ||
|
||
{% set _buttonClassName = _spiritClassPrefix ~ 'Button' %} | ||
{% set _color = (props.color is defined) ? ' ' ~ _buttonClassName ~ '--' ~ props.color : ' ' ~ _buttonClassName ~ '--inverted' %} | ||
{% set _square = _buttonClassName ~ '--square' %} | ||
|
||
{% set _iconClassName = _spiritClassPrefix ~ 'Header__icon' %} | ||
|
||
<div className="{{ _className }}"> | ||
<button class="{{ _buttonClassName }}{{ _color }}{{ _square }}" type="button" aria-expanded="false" {{ _ariaControls }}> | ||
<Button color="{{ props.color is defined ? props.color : 'inverted' }}" isSquare type="button" aria-expanded="false" aria-controls="{{ props.ariaControls is defined ? props.ariaControls : '' }}"> | ||
<span className="{{ _iconClassName }} {{ _iconClassName }}--menu" aria-hidden="true"></span> | ||
<span className="accessibility-hidden">{{ _label }}</span> | ||
</button> | ||
</Button> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{%- if id != null %} id="{{ id }}"{% endif -%}{%- for dataPropName, dataPropValue in dataAttributes %} {{ dataPropName }}="{{ dataPropValue }}"{% endfor -%} | ||
{%- if id != null %} id="{{ id }}"{% endif -%}{%- for propName, propValue in allowedAttributes %} {{ propName }}="{{ propValue }}"{% endfor -%} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...__snapshots__/ComponentsSnapshotTest__test with data set buttonWithMainProps.twig__1.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> | ||
<html><body> | ||
<button id="testId" data-main="main" class="Button Button--primary" type="button">button</button> | ||
<button id="testId" data-main="main" aria-label="label" class="Button Button--primary" type="button">button</button> | ||
</body></html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/web-twig/tests/components-fixtures/buttonWithMainProps.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<Button id="testId" data-main="main" not-valid-prop="unexist" color="primary">button</Button> | ||
<Button id="testId" data-main="main" aria-label="label" not-valid-prop="unexist" color="primary">button</Button> |