Skip to content

Commit

Permalink
[docs] Add examples of callback props
Browse files Browse the repository at this point in the history
  • Loading branch information
cee-chen committed Nov 17, 2023
1 parent cdc1c39 commit ba28dc0
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src-docs/src/views/tables/actions/actions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,13 +183,14 @@ export default () => {
} else {
let actions: Array<DefaultItemAction<User>> = [
{
name: 'Elastic.co',
description: 'Go to elastic.co',
name: 'User profile',
description: ({ firstName, lastName }) =>
`Visit ${firstName} ${lastName}'s profile`,
icon: 'editorLink',
color: 'primary',
type: 'icon',
href: 'https://elastic.co',
target: '_blank',
href: ({ id }) => `${window.location.href}?id=${id}`,
target: '_self',
'data-test-subj': 'action-outboundlink',
},
];
Expand All @@ -205,13 +206,14 @@ export default () => {
},
{
name: (user: User) => (user.id ? 'Delete' : 'Remove'),
description: 'Delete this user',
description: ({ firstName, lastName }) =>
`Delete ${firstName} ${lastName}`,
icon: 'trash',
color: 'danger',
type: 'icon',
onClick: deleteUser,
isPrimary: true,
'data-test-subj': 'action-delete',
'data-test-subj': ({ id }) => `action-delete-${id}`,
},
{
name: 'Edit',
Expand Down

0 comments on commit ba28dc0

Please sign in to comment.