1
1
import { useEffect } from 'react'
2
2
import { Meta , StoryObj } from '@storybook/react'
3
+ import { action } from '@storybook/addon-actions'
3
4
import {
4
5
Button ,
5
6
ButtonComponentType ,
@@ -22,7 +23,7 @@ import { ReactComponent as ICWarning } from '@Icons/ic-warning-y6.svg'
22
23
23
24
const CellComponent = ( { field, value, signals, row, isRowActive } : TableCellComponentProps ) => {
24
25
const handleButtonClick = ( ) => {
25
- alert ( `Row ${ value } clicked` )
26
+ action ( `Row ${ value } clicked` )
26
27
}
27
28
28
29
useEffect ( ( ) => {
@@ -44,7 +45,7 @@ const CellComponent = ({ field, value, signals, row, isRowActive }: TableCellCom
44
45
} ,
45
46
} ) => {
46
47
if ( id === row . id && field === 'name' ) {
47
- alert ( text )
48
+ action ( text )
48
49
}
49
50
}
50
51
@@ -58,7 +59,7 @@ const CellComponent = ({ field, value, signals, row, isRowActive }: TableCellCom
58
59
return ( ) => {
59
60
signals . removeEventListener ( TableSignalEnum . ENTER_PRESSED , rowEnterPressedCallback )
60
61
signals . removeEventListener ( TableSignalEnum . DELETE_PRESSED , deletePressedCallback )
61
- signals . addEventListener ( TableSignalEnum . OPEN_CONTEXT_MENU , openContextMenuCallback )
62
+ signals . removeEventListener ( TableSignalEnum . OPEN_CONTEXT_MENU , openContextMenuCallback )
62
63
}
63
64
} , [ ] )
64
65
@@ -180,7 +181,7 @@ const BulkActionsComponent = () => (
180
181
variant = { ButtonVariantType . borderLess }
181
182
ariaLabel = "Pause"
182
183
size = { ComponentSizeType . small }
183
- onClick = { ( ) => alert ( 'Pause clicked' ) }
184
+ onClick = { ( ) => action ( 'Pause clicked' ) }
184
185
showAriaLabelInTippy
185
186
/>
186
187
@@ -192,7 +193,7 @@ const BulkActionsComponent = () => (
192
193
variant = { ButtonVariantType . borderLess }
193
194
ariaLabel = "Play"
194
195
size = { ComponentSizeType . small }
195
- onClick = { ( ) => alert ( 'Play clicked!' ) }
196
+ onClick = { ( ) => action ( 'Play clicked!' ) }
196
197
showAriaLabelInTippy
197
198
/>
198
199
</ div >
0 commit comments