fix(console): polish Go limits chart on mobile (#51870)

This commit is contained in:
Victor Navarro
2026-09-28 15:39:52 +02:00
committed by GitHub
parent b76bbb3692
commit 3c893f0a16
3 changed files with 46 additions and 13 deletions
@@ -262,12 +262,16 @@
} }
/* Phones stack each model name above its bar so the table fits without horizontal scrolling. */ /* Phones stack each model name above its bar so the table fits without horizontal scrolling. */
@media (max-width: 40rem) { @media (max-width: 40rem) {
table, /* Rows share the table's columns through subgrid, so number columns size to their unwrapped headers. */
table {
display: grid;
grid-template-columns: minmax(0, 1fr) auto auto;
min-width: 0;
}
thead, thead,
tbody, tbody,
tfoot { tfoot {
display: block; display: contents;
min-width: 0;
} }
colgroup, colgroup,
tfoot td:not([data-slot="axis"]) { tfoot td:not([data-slot="axis"]) {
@@ -275,21 +279,23 @@
} }
tr { tr {
display: grid; display: grid;
grid-template-columns: minmax(0, 1fr) 5.5rem 4rem; grid-column: 1 / -1;
grid-template-columns: subgrid;
align-items: center; align-items: center;
} }
thead tr { thead tr {
border: 1px solid var(--go-console-border); border: 1px solid var(--go-console-border);
border-radius: 6px; border-radius: 6px;
} }
thead th { thead th,
thead th:is(:first-child, :last-child) {
border: 0; border: 0;
padding-inline: 0.5rem; padding-inline: 0.375rem;
white-space: normal; font-size: 0.75rem;
} }
/* The 100 and 1K ticks sit too close together to label both. */ /* The bars are too narrow to label 100 and 1K apart from 10K. */
[data-slot="gridline"]:first-child, [data-slot="gridline"],
[data-slot="axis"] span:first-child { [data-slot="axis"] span:not(:last-child) {
display: none; display: none;
} }
thead th:first-child { thead th:first-child {
@@ -301,17 +307,38 @@
} }
tbody th { tbody th {
grid-column: 1 / -1; grid-column: 1 / -1;
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 0.25rem 0.5rem;
padding-block-end: 0; padding-block-end: 0;
} }
[data-slot="labels"] {
margin-top: 0;
}
/* Bars extend under the requests column's spare header width, stopping short of the right-aligned numbers. */
[data-slot="bars"], [data-slot="bars"],
[data-slot="axis"] { [data-slot="axis"] {
margin-inline-start: 1rem; grid-column: 1 / 3;
margin-inline: 1rem 4rem;
}
[data-slot="bars"] {
grid-row: 2;
}
[data-slot="bars"] + [data-slot="number"] {
grid-row: 2;
grid-column: 2;
}
[data-slot="number"]:last-child {
grid-row: 2;
grid-column: 3;
} }
[data-slot="number"] { [data-slot="number"] {
padding-inline: 0.5rem; padding-inline: 0.375rem;
} }
/* Rows are grids here, so highlight the row itself instead of each cell. */ /* Rows are grids here, so highlight the row itself instead of each cell. */
tbody tr { tbody tr {
padding-block: 0.375rem;
border-radius: 6px; border-radius: 6px;
transition: background-color 120ms ease; transition: background-color 120ms ease;
} }
+1 -1
View File
@@ -286,7 +286,7 @@ export const dict = {
"go.graph.label": "Requests / 5 hours", "go.graph.label": "Requests / 5 hours",
"go.graph.period": "Usage", "go.graph.period": "Usage",
"go.graph.model": "Model", "go.graph.model": "Model",
"go.graph.requests": "Est. requests / 5 hr", "go.graph.requests": "Est. requests / 5h",
"go.graph.allowance": "Monthly usage", "go.graph.allowance": "Monthly usage",
"go.graph.new": "New", "go.graph.new": "New",
"go.graph.scale": "Nonlinear request scale", "go.graph.scale": "Nonlinear request scale",
@@ -365,6 +365,12 @@ body {
color: var(--color-text-strong); color: var(--color-text-strong);
line-height: 1.4; line-height: 1.4;
} }
@media (max-width: 40rem) {
flex-direction: column;
align-items: flex-start;
gap: 8px;
}
} }
[data-slot="hero-copy"] { [data-slot="hero-copy"] {