react-data-grid icon indicating copy to clipboard operation
react-data-grid copied to clipboard

Remove lineHeight and use flex to vertically align items

Open amanmahajan7 opened this issue 3 years ago • 3 comments

Blocker: overflow: hidden; text-overflow: ellipsis; does not work with display: flex without extra spans

amanmahajan7 avatar Jan 21 '22 22:01 amanmahajan7

Codecov Report

Merging #2794 (7271a13) into main (f864291) will decrease coverage by 0.00%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #2794      +/-   ##
==========================================
- Coverage   96.16%   96.16%   -0.01%     
==========================================
  Files          37       37              
  Lines        1226     1224       -2     
  Branches      383      382       -1     
==========================================
- Hits         1179     1177       -2     
  Misses         47       47              
Impacted Files Coverage Δ
src/DataGrid.tsx 94.26% <ø> (ø)
src/GroupRow.tsx 100.00% <ø> (ø)
src/HeaderRow.tsx 100.00% <ø> (ø)
src/Row.tsx 100.00% <ø> (ø)
src/SummaryRow.tsx 100.00% <ø> (ø)
src/style/cell.ts 100.00% <ø> (ø)
src/style/row.ts 100.00% <ø> (ø)
src/utils/index.ts 91.66% <100.00%> (-1.20%) :arrow_down:

codecov[bot] avatar Jan 21 '22 22:01 codecov[bot]

We can also center text vertically by removing the line-height on rows, and adding an empty pseudo-element in each cell like this. image

This works because the pseudo-element will have the full height of the cell, and its text will be centered vertically, then the remaining text will be aligned on the baseline by default, thus following the centered text (if there was any). I'm not sure how well this works with multi-line cells though.

Downside is that all cells must have an extra pseudo-element, and users might want to have their own instead.

nstepien avatar Feb 08 '22 14:02 nstepien

Interesting idea. May be line height is okay for now

amanmahajan7 avatar Feb 10 '22 22:02 amanmahajan7