forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Security Solution] expandable flyout - add tooltip to correlations t…
…able cells (elastic#166913)
- Loading branch information
1 parent
e7c4a84
commit b4d8f6e
Showing
4 changed files
with
91 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
...k/plugins/security_solution/public/flyout/shared/components/cell_tooltip_wrapper.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { render } from '@testing-library/react'; | ||
import { CellTooltipWrapper } from './cell_tooltip_wrapper'; | ||
|
||
const TEST_ID = 'test-id'; | ||
const children = <p data-test-subj={TEST_ID}>{'test content'}</p>; | ||
|
||
describe('<CellTooltipWrapper />', () => { | ||
it('should render non-expandable panel by default', () => { | ||
const { getByTestId } = render( | ||
<CellTooltipWrapper tooltip="test tooltip">{children}</CellTooltipWrapper> | ||
); | ||
expect(getByTestId(TEST_ID)).toBeInTheDocument(); | ||
}); | ||
}); |
35 changes: 35 additions & 0 deletions
35
x-pack/plugins/security_solution/public/flyout/shared/components/cell_tooltip_wrapper.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import type { VFC, ReactElement } from 'react'; | ||
import React from 'react'; | ||
import { EuiToolTip } from '@elastic/eui'; | ||
|
||
export interface CellTooltipWrapperProps { | ||
/** | ||
* Value displayed in the tooltip and in the cell itself | ||
*/ | ||
tooltip: string | ReactElement; | ||
/** | ||
* Tooltip anchor position | ||
*/ | ||
anchorPosition?: 'left' | 'right' | 'top' | 'bottom'; | ||
/** | ||
* React components to render | ||
*/ | ||
children: React.ReactElement; | ||
} | ||
|
||
export const CellTooltipWrapper: VFC<CellTooltipWrapperProps> = ({ | ||
tooltip, | ||
anchorPosition = 'top', | ||
children, | ||
}) => ( | ||
<EuiToolTip content={tooltip} position={anchorPosition}> | ||
{children} | ||
</EuiToolTip> | ||
); |