Skip to content

Commit

Permalink
[Data Explorer][Discover 2.0] Change to inspect icon and update hint msg
Browse files Browse the repository at this point in the history
  • Loading branch information
ananzh committed Aug 25, 2023
1 parent 551e432 commit d7a0223
Showing 1 changed file with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,24 @@
*/

import React from 'react';
import { i18n } from '@osd/i18n';
import { EuiToolTip, EuiButtonIcon, EuiDataGridCellValueElementProps } from '@elastic/eui';
import { useDataGridContext } from './data_grid_table_context';

export const DocViewExpandButton = ({
rowIndex,
setCellProps,
}: EuiDataGridCellValueElementProps) => {
export const DocViewExpandButton = ({ rowIndex }: EuiDataGridCellValueElementProps) => {
const { expandedHit, setExpandedHit, rows } = useDataGridContext();
const currentExpanded = rows[rowIndex];
const isCurrentExpanded = currentExpanded === expandedHit;
const inspectHintMsg = i18n.translate('discover.docViews.table.inspectAriaLabel', {
defaultMessage: 'Inspect document details',
});

return (
<EuiToolTip content={`Expand row ${rowIndex}`}>
<EuiToolTip content={inspectHintMsg}>
<EuiButtonIcon
onClick={() => setExpandedHit(isCurrentExpanded ? undefined : currentExpanded)}
iconType={isCurrentExpanded ? 'minimize' : 'expand'}
aria-label={`Expand row ${rowIndex}`}
iconType={isCurrentExpanded ? 'minimize' : 'inspect'}
aria-label={inspectHintMsg}
/>
</EuiToolTip>
);
Expand Down

0 comments on commit d7a0223

Please sign in to comment.