Skip to content

Set table cells to have shorter default height - #2158

Merged
david-crespo merged 5 commits into
mainfrom
tighter-table
Apr 18, 2024
Merged

david-crespo merged 5 commits into
mainfrom
tighter-table

Conversation

@charliepark

Copy link
Copy Markdown
Contributor

This PR sets the default table row height to the h-12 height, rather than the larger h-16.

So we move from a table looking like this:
Screenshot 2024-04-17 at 1 30 27 PM

To something more compact, like this:
Screenshot 2024-04-17 at 1 30 55 PM

37.5% more data on the screen*!

There are still some tables that require a larger height, and we can pass in a rowHeight prop to enable that. Here we have the InstancesPage table, which uses the useQueryTable hook, which invokes the app/table/Table.tsx component. With this wrapper component, we can pass in rowHeight as a prop to the overall Table component and the component passes it through to the Table.Cell in ui/lib/Table.tsx.
Screenshot 2024-04-17 at 1 29 49 PM

We also sometimes use the ui/lib/Table.tsx file directly, as in the UtilizationPage table. In cases like that, we have to pass the height prop directly to each Table.Cell, as the Table wrapper component doesn't pass anything directly along to its children table cells.
Screenshot 2024-04-17 at 1 29 57 PM

I'd prefer, I think, for us to not be involved at all in the height of these elements, and to instead just pass the data in and let the table cells dynamically update, with the appropriate cell-padding. The table would then flex to handle whatever the tallest content in the cells is. At the moment, though, the way we're doing borders on the cells would be a little fussy to get sorted, and there are a few things on our plate for V8. Happy to revisit that down the road.

@vercel

vercel Bot commented Apr 17, 2024 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
console ✅ Ready (Inspect) Visit Preview Apr 18, 2024 4:23pm

@david-crespo

Copy link
Copy Markdown
Collaborator

This
Is
The
Best

@david-crespo

Copy link
Copy Markdown
Collaborator

I think the problem with letting the table rows decide their own height based on the content is that you might not get the same height for all the rows. In practice maybe that's a small concern because we decide what all the cells are, and we would decide how tall they are. But it feels a little risky.

@charliepark

charliepark commented Apr 17, 2024 •

Copy link
Copy Markdown
Contributor Author

We could put a height on the cells to force a minimum height, but if you had something that was wildly larger, the row would flex to handle it, as in this codepen example (also different border colors and interior colors, for funsies)

ETA: I guess what I was getting at was that we can control the default of the rows, but if something breaks out of that minimum for some reason (say, content that wraps lines on a mobile screen or something), I'm okay with us not forcing every row in the table to have the same height, as long as every cell in each row has the same height.

@charliepark
charliepark marked this pull request as ready for review April 17, 2024 22:23
Comment thread app/table/QueryTable.tsx Resolved
@david-crespo

Copy link
Copy Markdown
Collaborator

IP pools might need to be a tall one for now until we redo the treatment of the utilization.

image

@david-crespo

Copy link
Copy Markdown
Collaborator

Well, on second thought that’s pretty silly since you can’t even have IPv6 ranges right now. I’ll take a look at tweaking that to fit on one line. Even if it’s mediocre, the fact is no one will ever see it.

@benjaminleonard
benjaminleonard self-requested a review April 18, 2024 10:26
@david-crespo

Copy link
Copy Markdown
Collaborator

Talked to @benjaminleonard and we decided to do nothing with the IP pool cells since the two line cell will never show up in production and it's not total shit (my words, not his).

@david-crespo

Copy link
Copy Markdown
Collaborator

Was about to say let's go but we have a problem on firewall rules. Dynamic height?

image

@david-crespo david-crespo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Firewall rules is non-ideal, but because we're leaving it tall, it's not any worse than it currently is, so that's fine. I'm testing out using ListPlusCell for the filters, that can be a followup.

@david-crespo
david-crespo merged commit 46dbd9c into main Apr 18, 2024
@david-crespo
david-crespo deleted the tighter-table branch April 18, 2024 19:09

This branch was successfully deployed

1 active deployment
Preview — 22bbad5b Deployed Apr 18, 2024 by vercel[bot]
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.

2 participants