Skip to content

Commit

Permalink
Feat(web-twig): Deprecate onClick prop on every component
Browse files Browse the repository at this point in the history
  * use native `onclick` attribute instead
  * deprecation will be removed in the next major version

refs #DS-645
  • Loading branch information
literat committed Apr 3, 2023
1 parent 2016587 commit e3a7684
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/web-twig/src/Resources/components/Button/Button.twig
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
{%- set _classNames = [ _rootClassName, _rootColorClassName, _rootSizeClassName, _rootBlockClassName, _rootSquareClassName, _class ] -%}
{%- set _allowedAttributes = [ 'name' ] -%}

{# Deprecations #}
{% if _onClick is same as('error') %}
{% deprecated 'Button: The "onClick" property will be removed in the next major version. Use native "onclick" attribute instead.' %}
{% endif %}

<button
{{ mainProps(props, _allowedAttributes) }}
{{ classProp(_classNames) }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@
] -%}


{# Deprecations #}
{% if _onClick is same as('error') %}
{% deprecated 'ButtonLink: The "onClick" property will be removed in the next major version. Use native "onclick" attribute instead.' %}
{% endif %}

{# Deprecations #}
{% if _onClick is same as('error') %}
{% deprecated 'ButtonLink: The "onClick" property will be removed in the next major version. Use native "onclick" attribute instead.' %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
{# Miscellaneous #}
{%- set _classNames = [ _rootClassName, _class ] -%}

{# Deprecations #}
{% if _onClick is same as('error') %}
{% deprecated 'Header: The "onClick" property will be removed in the next major version. Use native "onclick" attribute instead.' %}
{% endif %}

<button
{{ mainProps(props) }}
{{ classProp(_classNames) }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
{# Miscellaneous #}
{%- set _classNames = [ _rootClassName, _rootCurrentClassName, _class ] -%}

{# Deprecations #}
{% if _onClick is same as('error') %}
{% deprecated 'Header: The "onClick" property will be removed in the next major version. Use native "onclick" attribute instead.' %}
{% endif %}

<a
{{ mainProps(props) }}
{{ classProp(_classNames) }}
Expand Down
5 changes: 5 additions & 0 deletions packages/web-twig/src/Resources/components/Link/Link.twig
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@
{% deprecated 'Link: The "onClick" property will be removed in the next major version. Use native "onclick" attribute instead.' %}
{% endif %}

{# Deprecations #}
{% if _onClick is same as('error') %}
{% deprecated 'Link: The "onClick" property will be removed in the next major version. Use native "onclick" attribute instead.' %}
{% endif %}

<a
{{ mainProps(props) }}
href="{{ _href }}"
Expand Down

0 comments on commit e3a7684

Please sign in to comment.