-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
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
[Table] Add dense support #14561
[Table] Add dense support #14561
Conversation
09bb194
to
e0a5052
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
House style...
@mbrookes A linter rule for the house style, e.g. not importing non-default React exports, would be nice. Sorry for not applying your suggestions with GitHub, I didn't know you can batch them and didn't want to have one commit for every line. |
Sounds like the better option to me. |
Here's how the uses of 'dense' compare:
Fab API says: " |
@mbrookes Hm... I was thinking about adding a
|
I was just pointing out the inconsistencies in our current API regarding prop name, type and values.
To make the API more consistent (where it makes sense).
I don't think the name should necessarily reflect the CSS styles affected. We don't for most other style props. For example, as it stands, most of the props called margin set padding, not margin... I'm not suggesting changing it in this PR per se, but I do think we need to revisit the subject for the components listed in the table above. |
@mbrookes So… can we proceed with this PR? I'm done with the implementation, there hasn't been any feedback for some days. Reviews/approvals would speed this up a bit. 😅 |
What's the purpose of Do we need two demos? I'd prefer we keep the basic demo as simple as possible. The demos use hooks, but aren't named as such. I guess that's okay though if we're getting rid of hooks as a specific category for v4, and only having js (with hooks), or ts. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@mbrookes I didn't add The demo uses hooks to reduce code noise (would need to be a class component with state otherwise). I adjusted both demos because I wanted to show how to adjust the checkboxes to fit in dense tables. |
Looking at the PR #12415, I'd guess it was added simply because TableCell has it. Not sure how much use it is on the entire table - more likely to be used on a single column; but I guess it's harmless. I would remove it from the select though. However
Nothing wrong with using hooks. My point was that the file names are wrong, but that it doesn't matter so much, as we're planning on getting rid of the
Which it does. My question was do we also need the select in the basic demo? Like I said, I'd prefer we keep the basic demo as simple as possible. That said, it's much harder to unpick what's needed to make a table dense from the 'Sorting and Selecting' demo... While looking at that again, I noticed that in our current implementation, and the new dense one, the position of the checkbox WRT the left edge is incorrect: In both cases it should be 16px with a 24px checkbox: From the vertical grid lines (which we lack), it seems the checkbox is in the same column as the text (the text is a label on the checkbox). That may be for another PR though! |
@mbrookes That's what I thought, too and why I added it to both demos. 🤔 Adding a new demo for the dense table is an overkill too, on the other hand.
Nice! That'll be my contribution for next week. 😎 |
@leMaik Sorry, thought I'd left a comment, but must not have submitted it. It looks like the standard and dense Checkboxes now have the same padding as each other, but not as the v2 spec (16px). Had you planned to fix that? |
@mbrookes Oh, the padding changed. I thought it was only the dense checkbox being inconsistent. I'll fix it. Edit: I have changed it locally, but there are more changes to the data table specs (e.g. the sorting arrow is now 18px instead of 16px wide). Let's put these changes into a new PR. Edit²: The |
Lol Yeah. Let's not overload one PR. |
Maybe wrap the displayed demos in their own themeprovider and give people the ability to play around with it. Gives us another way of teaching how to override stuff (props, style etc) and in this case the ability to see how dense tables look for every demo. |
0bae7ae
to
8dba7d2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see a reason not to include the default vs. normal change in this already breaking change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The enhanced hook and non hook demos are different. How should we unify them?
I have tried to list the breaking changes in the pull request description. Have I missed one? |
@oliviertassinari |
@leMaik Oh right, thanks. I have added this breaking change in the pull request description. I'm rebasing it :). |
f18c798
to
fecd625
Compare
fecd625
to
b12ac64
Compare
We had 6 conflits after merging #14536. I went with the simplest resolution strategy: squash + resolve. I'm sorry, we have lost the commit history. |
@leMaik well done |
The TableCell class keys have not been updated yet. For example, it still contains Also, |
@ljvanschie Well spotted! Do you want to submit a pull request that fixes the TypeScript class key definition? :) |
Breaking change
dense
mode was promoted to a different property:Currently, setting
padding="dense"
doesn't really do much for theTable
. As described in #14521, the Material Design specs now contain some information about density. This is useful for tables in desktop web apps, where finger-friendlyness isn't important.I also experimented with adding a new
dense
prop and passing it through viaTableContext
, but that adds a lot more code for the same benefit.As it is now, this would be a breaking change because the old
padding="dense"
behavior is removed. I don't know what the old behavior was used for. 🤷♂️Also, dense pagination is weird… the
IconButton
s aren't really made for smaller sizes. When using aCheckBox
in the table, the padding of it must be set¹ to0
, then it'll just work and look as in the guidelines:¹ Maybe we could add
padding="none"
for IconButtons?