Skip to content

Commit

Permalink
Feat(web-twig): Allow pass translate attribute to the Heading and…
Browse files Browse the repository at this point in the history
… `Text` components
  • Loading branch information
dlouhak authored and literat committed Jun 23, 2023
1 parent 1841edb commit 82f1395
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
{# Miscellaneous #}
{%- set _styleProps = useStyleProps(props) -%}
{%- set _classNames = [ _rootClassName, _styleProps.className ] -%}
{%- set _allowedAttributes = [ 'translate' ] -%}

<{{ _elementType }} {{ mainProps(props) }} {{ styleProp(_styleProps) }} {{ classProp(_classNames) }}>
<{{ _elementType }} {{ mainProps(props, _allowedAttributes) }} {{ styleProp(_styleProps) }} {{ classProp(_classNames) }}>
{%- block content %}{% endblock -%}
</{{ _elementType }}>
3 changes: 2 additions & 1 deletion packages/web-twig/src/Resources/components/Text/Text.twig
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
{# Miscellaneous #}
{%- set _styleProps = useStyleProps(props) -%}
{%- set _classNames = [ _rootClassName, _styleProps.className ] -%}
{%- set _allowedAttributes = [ 'translate' ] -%}

<{{ _elementType }} {{ mainProps(props) }} {{ styleProp(_styleProps) }} {{ classProp(_classNames) }}>
<{{ _elementType }} {{ mainProps(props, _allowedAttributes) }} {{ styleProp(_styleProps) }} {{ classProp(_classNames) }}>
{%- block content %}{% endblock -%}
</{{ _elementType }}>
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ <h1 class="typography-heading-medium-text">
Example heading
</h1>

<div class="typography-heading-large-text">
<div translate="no" class="typography-heading-large-text">
Example heading
</div>
</body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
Example text
</p>

<div class="typography-body-medium-text-regular">
<div translate="no" class="typography-body-medium-text-regular">
Example text
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
<Heading elementType="h1">
Example heading
</Heading>
<Heading size="large">
<Heading size="large" translate="no">
Example heading
</Heading>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Text>
Example text
</Text>
<Text elementType="div">
<Text elementType="div" translate="no">
Example text
</Text>
<Text size="large" emphasis="bold">
Expand Down

0 comments on commit 82f1395

Please sign in to comment.