Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EuiDatagrid] fix content header styles to ensure text alignment is applied #7720

Merged

Conversation

mgadewoll
Copy link
Contributor

@mgadewoll mgadewoll commented Apr 30, 2024

Summary

closes #7669

This PR adds styles back to .euiDataGridHeaderCell__content that were removed previously in this PR.
These styles ensure the header content is stretched and allows for its content to properly apply its own text styles.

Additionally this PR adds a Playground story for EuiDataGrid for easier testing.

after
Screenshot 2024-04-30 at 14 11 09

QA

  • ensure custom text alignment styles are applied

    • checkout this PR gh pr checkout 7720
    • go to src-docs/src/views/datagrid/basics/datagrid.js and update a column to use a custom display value, e.g.:
    const columns = [
      {
        id: 'name',
        display: <div style={{ textAlign: 'right' }}>Name</div>, // add this
        ...
      },
      ...
    ]
    • go to: http://localhost:8030/#/tabular-content/data-grid#core-concepts and confirm the changed column header now is right aligned
  • review the added EuiDataGrid story and its controls that they are useable and useful

General checklist

  • Browser QA
    • Checked in both light and dark modes
    • Checked in mobile
    • Checked in Chrome, Safari, Edge, and Firefox
    • Checked for accessibility including keyboard-only and screenreader modes
  • Docs site QA - N/A
  • Code quality checklist - N/A
  • Release checklist
    • A changelog entry exists and is marked appropriately.
    • If applicable, added the breaking change issue label (and filled out the breaking change checklist)
  • Designer checklist - N/A

@mgadewoll mgadewoll added bug documentation Issues or PRs that only affect documentation - will not need changelog entries labels Apr 30, 2024
@mgadewoll mgadewoll marked this pull request as ready for review April 30, 2024 12:55
@mgadewoll mgadewoll requested a review from a team as a code owner April 30, 2024 12:55
Copy link
Contributor

Choose a reason for hiding this comment

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

me initially seeing the 300+ line diff on this PR: panik
me seeing it's a storybook story: kalm

In all seriousness thanks for going the extra mile to add a storybook for EuiDataGrid! 🙌

Copy link
Contributor

@cee-chen cee-chen left a comment

Choose a reason for hiding this comment

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

Changes look great. Thanks again for going the extra mile Lene!

@kibanamachine
Copy link

Preview staging links for this PR:

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

@mgadewoll mgadewoll merged commit 67a0675 into elastic:main May 2, 2024
7 checks passed
@mgadewoll mgadewoll deleted the datagrid/7669-header-text-alignment branch May 3, 2024 07:16
mgadewoll added a commit to mgadewoll/eui that referenced this pull request May 3, 2024
jbudz pushed a commit to elastic/kibana that referenced this pull request May 10, 2024
`v94.2.1-backport.0` ⏩ `v94.3.0`

_[Questions? Please see our Kibana upgrade
FAQ.](https://github.com/elastic/eui/blob/main/wiki/eui-team-processes/upgrading-kibana.md#faq-for-kibana-teams)_

---

## [`v94.3.0`](https://github.com/elastic/eui/releases/v94.3.0)

- Updated `launch` glyph for `EuiIcon`
([#7670](elastic/eui#7670))
- Updated `EuiComboBox`'s `options` to support including tooltip details
for selectable options. Use `toolTipContent` to render tooltip
information, and `toolTipProps` to optionally customize the tooltip
rendering behavior ([#7700](elastic/eui#7700))
- Updated the following existing glyphs in `EuiIcon`:
([#7727](elastic/eui#7727))
  - `error` (now an outlined version instead of filled) 
  - `tokenMetricCounter`
  - `tokenMetricGauge` 
- Added the following new glyphs to `EuiIcon`:
([#7727](elastic/eui#7727))
  - `tokenDimension`
  - `clickLeft`
  - `clickRight`
  - `clockCounter`
  - `errorFilled` (the previous `error` glyph design)
  - `warningFilled`

**Bug fixes**

- Fixed a visual layout bug for `EuiComboBox` with `isLoading` in mobile
views ([#7700](elastic/eui#7700))
- Fixed missing styles on header cells of `EuiDataGrid` that prevented
content text alignment styles to apply
([#7720](elastic/eui#7720))
- Fixed `EuiFlexGroup` and `EuiFlexItem` `ref` prop typing to support
refs of the same type as the passed `component` type and allow
`displayName` to be defined for easy component naming when using
component wrappers like `styled()`
([#7724](elastic/eui#7724))

---

Most of the code changes you'll see in this PR are caused by the recent
EuiFlex* changes making it generic. This, unfortunately, is something
that `styled()` doesn't always like. I replaced the failing usages of
`styled(EuiFlexGroup)` and `styled(EuiFlexItem)` to use `component` and
other native EuiFlex* props, resulting in the same output but being
better typed.

We plan to add more props to EuiFlex* components giving developers
control over properties like `flex-grow` and `flex-shring`, and reducing
the need for writing any custom CSS when using these components. This
should reduce the number of `styled()` wrappers needed even further

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug documentation Issues or PRs that only affect documentation - will not need changelog entries
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[EuiDataGrid] cannot apply text alignment styles to Data grid headers
4 participants