Skip to content

report(metrics): use css grid so metrics are aligned #10695

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

Merged
merged 5 commits into from
May 13, 2020

Conversation

connorjclark
Copy link
Collaborator

before:

image

after:

image

@connorjclark connorjclark requested a review from a team as a code owner May 3, 2020 21:35
@connorjclark connorjclark requested review from brendankenny and removed request for a team May 3, 2020 21:35
@patrickhulce
Copy link
Collaborator

there needs to be a 😍 reaction on PRs :)

}
.lh-metrics-container {
display: grid;
grid-template-rows: 1fr 1fr 1fr;
Copy link
Member

Choose a reason for hiding this comment

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

dunno a lot about grid but does this need to be repeated 3 times? what if another metric is added via custom config or w/e. do we need changes here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

right, a 7th metric would make a new column and be weird ...

if instead i used grid-template-columns: 1fr 1fr (and drop the grid-flow: columns so it defaults to rows) the order is no longer we want:

image

we forced this order before by using two divs, but that didn't allow for alignment.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

idk how to solve this other than keeping as-is and being ok with this in for some reason there is another metric in the LHR

image

I think we'd redesign this whole thing if we had >6 metrics here tho..

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

another solution: interleave the creation of these lh-metric divs such that the rendering order is good. like 1 4 2 5 3 6 ...

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

in other words, css grid doesnt allow for letting elements fill up a column 1 first, column 2 second, and then not create a 3rd column (what would that css even look like...)

Copy link
Member

Choose a reason for hiding this comment

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

gotcha. IMO with 7 metrics it doesnt look that bad.

I'm fine with keeping the css as you have it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

cool 🫘

.lh-column:first-of-type {
margin-right: 8px;
@media screen and (min-width: 640px) {
.lh-metric:nth-last-child(-n+2) {
Copy link
Member

Choose a reason for hiding this comment

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

fancy footwork. 🕺

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants