Skip to content

[EuiDataGrid] use schema sorting labels instead of placeholder value#4199

Merged
chandlerprall merged 4 commits intoelastic:masterfrom
chandlerprall:bug/4197-datagrid-schema-placeholder-text
Oct 30, 2020
Merged

[EuiDataGrid] use schema sorting labels instead of placeholder value#4199
chandlerprall merged 4 commits intoelastic:masterfrom
chandlerprall:bug/4197-datagrid-schema-placeholder-text

Conversation

@chandlerprall
Copy link
Copy Markdown
Contributor

@chandlerprall chandlerprall commented Oct 29, 2020

Summary

Came up again in #4197 but also reported in slack last week, the recently added column actions used placeholder copy for sort text instead of using the column schema's labels.

I opted to nest the existing i18n'd labels (A-Z, High-Low) into a new i18n token which prepends Sort . I think this combines the best of re-usability while retaining flexibility for downstream consuming applications. I confirmed these overrides work as expected (see below).

Before

Screen Shot 2020-10-29 at 11 47 43 AM

After

Screen Shot 2020-10-29 at 11 48 04 AM

Localized schema labels

      i18n={{
        mapping: {
          'euiColumnSortingDraggable.defaultSortAsc': 'Going down',
          'euiColumnSortingDraggable.defaultSortDesc': 'Going up',
          'euiDataGridSchema.currencySortTextAsc': 'Increasing',
          'euiDataGridSchema.currencySortTextDesc': 'Decreasing',
        },
      }}

sort_i18n

Localized schema + sort labels

      i18n={{
        mapping: {
          'euiColumnSortingDraggable.defaultSortAsc': 'Going down',
          'euiColumnSortingDraggable.defaultSortDesc': 'Going up',
          'euiDataGridSchema.currencySortTextAsc': 'Increasing',
          'euiDataGridSchema.currencySortTextDesc': 'Decreasing',
          'euiColumnActions.sort': 'Order: {schemaLabel}',
        },
      }}

Screen Shot 2020-10-29 at 12 52 18 PM

Checklist

- [ ] Check against all themes for compatibility in both light and dark modes
- [ ] Checked in mobile
- [ ] Checked in Chrome, Safari, Edge, and Firefox
- [ ] Props have proper autodocs
- [ ] Added documentation
- [ ] Checked Code Sandbox works for the any docs examples

  • Added or updated jest tests
  • Checked for breaking changes and labeled appropriately
    - [ ] Checked for accessibility including keyboard-only and screenreader modes
  • A changelog entry exists and is marked appropriately

@kibanamachine
Copy link
Copy Markdown

Preview documentation changes for this PR: https://eui.elastic.co/pr_4199/

Copy link
Copy Markdown
Contributor

@thompsongl thompsongl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I opted to nest the existing i18n'd labels (A-Z, High-Low) into a new i18n token which prepends Sort

I agree this is a good approach.

Confirmed the new labels in the docs preview.

Need to updated some snapshots and add a changelog entry, but otherwise LGTM

@kibanamachine
Copy link
Copy Markdown

Preview documentation changes for this PR: https://eui.elastic.co/pr_4199/

@chandlerprall chandlerprall merged commit c067b3c into elastic:master Oct 30, 2020
@chandlerprall chandlerprall deleted the bug/4197-datagrid-schema-placeholder-text branch October 30, 2020 16:35
cchaos pushed a commit to andreadelrio/eui that referenced this pull request Nov 4, 2020
…lastic#4199)

* Modified datagrid column actions to use schema sorting labels instead of placeholder text

* snapshot updates

* changelog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants