Skip to content

Commit

Permalink
feat: update export tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
hiddeottens committed Apr 29, 2024
1 parent 8851a6e commit f4fa3fe
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 7 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "14.2.0",
"version": "14.3.0",
"license": "MIT",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
Expand Down
2 changes: 1 addition & 1 deletion src/components/data-grid/DataGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,7 @@ export const DataGrid = ({
onBulkDelete={onBulkDelete}
hideDownload={hideDownload}
hideDelete={hideDelete}
showExportTooltip={!!selectedGroupOption}
showExportTooltip={!!selectedGroupOption || rowsSelected > 0}
/>
)}
<FlexItem width="auto" gap={scale300}>
Expand Down
14 changes: 13 additions & 1 deletion src/components/data-grid/DataGridActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,18 @@ export const DataGridActions = ({
return null;
}

const getToolTipText = () => {
if (!showExportTooltip) {
return '';
}

if (rowsSelected) {
return translations.exportTooltipGrouping;
}

return translations.exportTooltipNoSelection;
};

return (
<StyledDataGridActions>
{!hideDelete && onBulkDelete ? (
Expand All @@ -89,7 +101,7 @@ export const DataGridActions = ({
>
<Button kind={ButtonKind.tertiary} disabled={!rowsSelected} testId={EXPORT_BUTTON_TEST_ID}>
<StatefulTooltip
content={showExportTooltip ? translations.exportTooltip : ''}
content={getToolTipText()}
showArrow={true}
placement="top"
overrides={{
Expand Down
3 changes: 2 additions & 1 deletion src/components/data-grid/defaultTranslations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,6 @@ export const defaultTranslations: Translations = {
emptyGroup: {
teamName: 'No team',
},
exportTooltip: 'Change the “Group by” dropdown to “None” to be able to export the employee insights.',
exportTooltipGrouping: 'Change the “Group by” dropdown to “None” to be able to export.',
exportTooltipNoSelection: 'Select at least one row to make an export.',
};
3 changes: 2 additions & 1 deletion src/components/data-grid/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,8 @@ export interface Translations {
clearFilters: string;
add: string;
emptyGroup: EmptyGroup;
exportTooltip: string;
exportTooltipGrouping: string;
exportTooltipNoSelection: string;
}

export interface DataGridSetting {
Expand Down

0 comments on commit f4fa3fe

Please sign in to comment.