File tree Expand file tree Collapse file tree 2 files changed +17
-16
lines changed Expand file tree Collapse file tree 2 files changed +17
-16
lines changed Original file line number Diff line number Diff line change @@ -30,9 +30,8 @@ interface StateProps {
30
30
}
31
31
32
32
interface DispatchProps {
33
- toggleBookmark : ClickHandler < HTMLButtonElement >
33
+ toggleBookmark : ( element : HTMLElement ) => void
34
34
}
35
-
36
35
export type Props = OwnProps & StateProps & DispatchProps
37
36
38
37
class BookmarkButton extends PureComponent < Props > {
@@ -67,7 +66,11 @@ class BookmarkButton extends PureComponent<Props> {
67
66
68
67
return (
69
68
< ButtonItem
70
- onClick = { ( ) => ! isPageSaved && this . props . toggleBookmark }
69
+ onClick = { ( event ) => {
70
+ if ( ! isPageSaved ) {
71
+ this . props . toggleBookmark ( event . currentTarget )
72
+ }
73
+ } }
71
74
disabled = { this . props . isDisabled || isPageSaved }
72
75
>
73
76
< Icon
@@ -140,15 +143,11 @@ const mapDispatch: (dispatch, props: OwnProps) => DispatchProps = (
140
143
dispatch ,
141
144
props ,
142
145
) => ( {
143
- toggleBookmark : async ( e ) => {
144
- {
145
- const allowed = await pageActionAllowed ( analyticsBG )
146
-
147
- if ( allowed ) {
148
- e . preventDefault ( )
146
+ toggleBookmark : async ( element : HTMLElement ) => {
147
+ const allowed = await pageActionAllowed ( analyticsBG )
149
148
150
- await dispatch ( acts . toggleBookmark ( ) )
151
- }
149
+ if ( allowed ) {
150
+ await dispatch ( acts . toggleBookmark ( ) )
152
151
}
153
152
} ,
154
153
} )
Original file line number Diff line number Diff line change @@ -20,8 +20,8 @@ interface StateProps {
20
20
}
21
21
22
22
interface DispatchProps {
23
- toggleCollectionsPopup : ClickHandler < HTMLButtonElement >
24
- toggleAllTabsPopup : ClickHandler < HTMLButtonElement >
23
+ toggleCollectionsPopup : ClickHandler < HTMLDivElement >
24
+ toggleAllTabsPopup : ClickHandler < HTMLDivElement >
25
25
}
26
26
27
27
export type Props = OwnProps & StateProps & DispatchProps
@@ -55,9 +55,11 @@ class CollectionsButton extends PureComponent<Props> {
55
55
render ( ) {
56
56
return (
57
57
< ButtonItem
58
- onClick = { ( ) =>
59
- ! this . props . isDisabled && this . props . toggleCollectionsPopup
60
- }
58
+ onClick = { ( event ) => {
59
+ if ( ! this . props . isDisabled ) {
60
+ this . props . toggleCollectionsPopup ( event )
61
+ }
62
+ } }
61
63
disabled = { this . props . isDisabled }
62
64
>
63
65
< Icon
You can’t perform that action at this time.
0 commit comments