Skip to content

Commit b9aa01c

Browse files
committed
Fix(web-twig): Remove unused Header Button onClick prop
1 parent b7e5bab commit b9aa01c

File tree

6 files changed

+16
-27
lines changed

6 files changed

+16
-27
lines changed

packages/web-twig/src/Resources/components/Header/README.md

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ Both links and buttons are supported:
235235
<HeaderLink href="/">Link item</HeaderLink>
236236
</HeaderNavItem>
237237
<HeaderNavItem>
238-
<HeaderButton onClick="console.log('Hello!')">Button item</HeaderButton>
238+
<HeaderButton>Button item</HeaderButton>
239239
</HeaderNavItem>
240240
</HeaderNav>
241241
```
@@ -264,10 +264,9 @@ Both links and buttons are supported:
264264

265265
##### HeaderButton API
266266

267-
| Prop name | Type | Default | Required | Description |
268-
| --------- | -------- | ------- | -------- | ------------------------- |
269-
| `class` | `string` | `null` | no | Custom CSS class |
270-
| `onClick` | `string` || yes | Function to call on click |
267+
| Prop name | Type | Default | Required | Description |
268+
| --------- | -------- | ------- | -------- | ---------------- |
269+
| `class` | `string` | `null` | no | Custom CSS class |
271270

272271
On top of the API options, you can add `data-*` or `aria-*` attributes to
273272
further extend component's descriptiveness and accessibility. These attributes
@@ -376,7 +375,7 @@ Navigation items can be links, buttons, or just text:
376375
</HeaderDialogLink>
377376
</HeaderDialogNavItem>
378377
<HeaderDialogNavItem>
379-
<HeaderDialogButton onClick="console.log('Hello!')">
378+
<HeaderDialogButton>
380379
Button item
381380
</HeaderDialogButton>
382381
</HeaderDialogNavItem>
@@ -412,10 +411,9 @@ Navigation items can be links, buttons, or just text:
412411

413412
##### HeaderDialogButton API
414413

415-
| Prop name | Type | Default | Required | Description |
416-
| --------- | -------- | ------- | -------- | ------------------------- |
417-
| `class` | `string` | `null` | no | Custom CSS class |
418-
| `onClick` | `string` || yes | Function to call on click |
414+
| Prop name | Type | Default | Required | Description |
415+
| --------- | -------- | ------- | -------- | ---------------- |
416+
| `class` | `string` | `null` | no | Custom CSS class |
419417

420418
##### HeaderDialogText API
421419

packages/web-twig/src/Resources/components/Header/_abstracts/Button.twig

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{# API #}
22
{%- set props = props | default([]) -%}
33
{%- set _class = props.class | default(null) -%}
4-
{%- set _onClick = props.onClick -%}
54
{%- set _rootClass = props.rootClass -%}
65

76
{# Class names #}
@@ -10,15 +9,9 @@
109
{# Miscellaneous #}
1110
{%- set _classNames = [ _rootClassName, _class ] -%}
1211

13-
{# Deprecations #}
14-
{% if _onClick %}
15-
{% deprecated 'Header: The "onClick" property will be removed in the next major version. Use native "onclick" attribute instead.' %}
16-
{% endif %}
17-
1812
<button
1913
{{ mainProps(props) }}
2014
{{ classProp(_classNames) }}
21-
onclick="{{ _onClick }}"
2215
type="button"
2316
>
2417
{% block content %}{% endblock %}

packages/web-twig/tests/__snapshots__/ComponentsSnapshotTest__test with data set headerButton.twig__1.html

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
<title></title>
55
</head>
66
<body>
7-
<button class="HeaderLink" onclick="console.log('Hello!')" type="button">My account</button>
8-
<!-- Render with all props -->
9-
<button class="HeaderLink my-custom-class" onclick="console.log('Hello!')" type="button">My account</button>
7+
<button class="HeaderLink" type="button">My account</button> <!-- Render with all props -->
8+
<button class="HeaderLink my-custom-class" type="button">My account</button>
109
</body>
1110
</html>

packages/web-twig/tests/__snapshots__/ComponentsSnapshotTest__test with data set headerDialogButton.twig__1.html

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
<title></title>
55
</head>
66
<body>
7-
<button class="HeaderDialogLink" onclick="console.log('Hello!')" type="button">My account</button>
8-
<!-- Render with all props -->
9-
<button class="HeaderDialogLink my-custom-class" onclick="console.log('Hello!')" type="button">My account</button>
7+
<button class="HeaderDialogLink" type="button">My account</button> <!-- Render with all props -->
8+
<button class="HeaderDialogLink my-custom-class" type="button">My account</button>
109
</body>
1110
</html>
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
<HeaderButton onClick="console.log('Hello!')">My account</HeaderButton>
1+
<HeaderButton>My account</HeaderButton>
22

33
<!-- Render with all props -->
4-
<HeaderButton class="my-custom-class" onClick="console.log('Hello!')">
4+
<HeaderButton class="my-custom-class">
55
My account
66
</HeaderButton>
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
<HeaderDialogButton onClick="console.log('Hello!')">My account</HeaderDialogButton>
1+
<HeaderDialogButton>My account</HeaderDialogButton>
22

33
<!-- Render with all props -->
4-
<HeaderDialogButton class="my-custom-class" onClick="console.log('Hello!')">
4+
<HeaderDialogButton class="my-custom-class">
55
My account
66
</HeaderDialogButton>

0 commit comments

Comments
 (0)