The page ran the full width of the shell, so a card was roughly 1300px of which the content used the left third. Every previous attempt fought that inside the card by capping or shrinking .kv-list, which only moved the imbalance around: the lists changed width but the Repositories and Providers tables stayed stretched just as far, and shrinking the lists broke the row separators and the alignment of the Edit column. Constrain the page container instead. One max-width and auto margins on the view fixes every child at once, so cards, key/value lists and tables all sit on the same readable measure and the leftover space falls outside the cards where it reads as margin rather than as a hole. Scoped to this page as .cfg-page rather than added to .page-head, which every other view shares; widening that is a separate decision. This is what `margin: 0 auto` was for. Applying it to .kv-list, which is what I tried first, really would have misaligned each list against its own card heading and against the table beneath it, and I used that to rule the approach out rather than to move it up a level.
303 lines
8.1 KiB
CSS
303 lines
8.1 KiB
CSS
/* Configuration-only styles.
|
|
*
|
|
* Rewritten because the previous layout had three compounding faults, all
|
|
* visible on a wide screen:
|
|
*
|
|
* 1. .cfg-row used `justify-content: space-between` on a full-width card,
|
|
* so the label sat at the far left and the value at the far right with
|
|
* ~1000px of dead space between them. Pairing a label to its value meant
|
|
* tracking across the whole viewport. An earlier "tighten spacing" pass
|
|
* reduced vertical padding only, which is why it did not help.
|
|
* 2. .cfg-value had no `min-width: 0`, so a long value could not shrink
|
|
* inside its flex parent and overflowed into the Edit button, visually
|
|
* truncating the number ("400" reading as "40") and colliding with it.
|
|
* 3. The locked-row reason was a flex sibling of an overflowing value, so
|
|
* it ran straight onto the end of the path with no visible separation
|
|
* ("...archie/work" + "pins the daemon's working layout").
|
|
*
|
|
* The replacement is a three-column grid: label, value, actions. Label and
|
|
* value are adjacent and left-aligned so the eye travels a fixed short
|
|
* distance regardless of viewport width; the value column is `minmax(0, 1fr)`
|
|
* so it can actually shrink; actions occupy a reserved column so nothing can
|
|
* ever overlap them. Secondary text (locked reason, override note, error)
|
|
* gets its own grid row rather than being crammed onto the value line.
|
|
*/
|
|
|
|
/* Cap and centre the whole page, not the individual lists.
|
|
*
|
|
* The page ran the full width of the shell, so a card was ~1300px of which
|
|
* the content used the left third. Earlier attempts fought that inside the
|
|
* card, capping or shrinking .kv-list, which only moved the imbalance around
|
|
* and left the Repositories and Providers tables stretched just as far.
|
|
*
|
|
* Constraining the page container fixes every child at once: cards, key/value
|
|
* lists and tables all take a readable measure, and the leftover space sits
|
|
* outside the cards where it reads as margin rather than as a hole in the
|
|
* layout. Scoped to this page rather than added to .page-head, which is
|
|
* shared with every other view.
|
|
*/
|
|
.cfg-page {
|
|
max-width: 70rem;
|
|
margin: 0 auto;
|
|
}
|
|
|
|
.cfg-section {
|
|
margin-bottom: var(--sp-4);
|
|
}
|
|
|
|
.cfg-subhead {
|
|
font-size: var(--text-sm);
|
|
font-weight: 600;
|
|
color: var(--fg-muted);
|
|
margin: var(--sp-5) 0 var(--sp-2);
|
|
}
|
|
|
|
.cfg-subhead:first-child {
|
|
margin-top: 0;
|
|
}
|
|
|
|
/* Key/value list.
|
|
*
|
|
* Two separate things were conflated in earlier attempts at this:
|
|
*
|
|
* - how far the value sits from its label, and
|
|
* - how wide the row is.
|
|
*
|
|
* They are different knobs. The original bug was the first (label left,
|
|
* value flung to the right edge), and shrinking the whole list to its
|
|
* content fixed it by breaking the second: rows became narrow, every list
|
|
* ended at a different width, the row separators stopped mid-card, and the
|
|
* Edit buttons no longer lined up with each other.
|
|
*
|
|
* So: the label column hugs its content (max-content, so the value starts
|
|
* immediately after the longest label), the value column takes the slack,
|
|
* and the actions column is pinned to the right edge. The row spans the
|
|
* card, which keeps the separators full width and puts every Edit in one
|
|
* consistent column, while the label-to-value distance stays short.
|
|
*/
|
|
/* The list owns the columns, not the row. Each .kv used to be its own grid,
|
|
which meant no row could size a column against any other row: a
|
|
max-content label track would end at a different x per row and the values
|
|
would come out ragged. Declaring the tracks once on the list and having
|
|
each row adopt them with `subgrid` gives one shared label column, sized to
|
|
the longest label and no wider. */
|
|
.kv-list {
|
|
display: grid;
|
|
grid-template-columns: max-content minmax(0, 1fr) auto;
|
|
column-gap: var(--sp-4);
|
|
row-gap: 0;
|
|
}
|
|
|
|
.kv {
|
|
display: grid;
|
|
grid-template-columns: subgrid;
|
|
grid-column: 1 / -1;
|
|
align-items: center;
|
|
row-gap: var(--sp-1);
|
|
padding: var(--sp-2) 0;
|
|
border-radius: var(--radius-sm);
|
|
}
|
|
|
|
/* Without subgrid the row cannot borrow the list's tracks, so fall back to a
|
|
per-row grid with a bounded label column. Values align because every row
|
|
resolves the same fixed range against the same container width. */
|
|
@supports not (grid-template-columns: subgrid) {
|
|
.kv-list {
|
|
display: flex;
|
|
flex-direction: column;
|
|
width: auto;
|
|
}
|
|
|
|
.kv {
|
|
grid-template-columns: minmax(8rem, 16rem) minmax(0, 1fr) auto;
|
|
column-gap: var(--sp-4);
|
|
}
|
|
}
|
|
|
|
.kv + .kv {
|
|
border-top: 1px solid var(--border);
|
|
}
|
|
|
|
.kv:hover {
|
|
background: var(--surface-hover);
|
|
}
|
|
|
|
.kv-label {
|
|
font-size: var(--text-sm);
|
|
color: var(--fg-muted);
|
|
}
|
|
|
|
/* min-width: 0 is load-bearing. A grid item defaults to min-width: auto,
|
|
which refuses to shrink below its content and is what pushed long paths
|
|
into the action column. */
|
|
.kv-value {
|
|
min-width: 0;
|
|
font-size: var(--text-sm);
|
|
color: var(--fg);
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
white-space: nowrap;
|
|
}
|
|
|
|
.kv-value.is-empty {
|
|
color: var(--fg-subtle);
|
|
}
|
|
|
|
.kv-actions {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: var(--sp-2);
|
|
justify-self: end;
|
|
}
|
|
|
|
/* Secondary line: locked reason, override note, validation error. Starts in
|
|
the value column so it aligns under the value it describes. */
|
|
.kv-note {
|
|
grid-column: 2 / -1;
|
|
font-size: var(--text-xs);
|
|
color: var(--fg-subtle);
|
|
}
|
|
|
|
.kv-note.is-error {
|
|
color: var(--danger);
|
|
}
|
|
|
|
.kv.is-locked .kv-value {
|
|
color: var(--fg-muted);
|
|
}
|
|
|
|
/* Actions stay visible rather than appearing on hover: a control that only
|
|
exists on hover is invisible to touch and to anyone scanning for what is
|
|
editable. Low contrast until the row is hovered or focused instead. */
|
|
.kv-btn {
|
|
font: inherit;
|
|
font-size: var(--text-xs);
|
|
color: var(--fg-subtle);
|
|
background: transparent;
|
|
border: 1px solid var(--border);
|
|
border-radius: var(--radius-sm);
|
|
padding: 2px var(--sp-2);
|
|
cursor: pointer;
|
|
flex: none;
|
|
transition: color 0.12s ease, border-color 0.12s ease, background 0.12s ease;
|
|
}
|
|
|
|
.kv:hover .kv-btn,
|
|
.kv:focus-within .kv-btn {
|
|
color: var(--fg-muted);
|
|
border-color: var(--border-strong);
|
|
}
|
|
|
|
.kv-btn:hover {
|
|
color: var(--fg);
|
|
border-color: var(--accent);
|
|
background: var(--accent-soft);
|
|
}
|
|
|
|
.kv-btn:focus-visible {
|
|
outline: 2px solid var(--accent);
|
|
outline-offset: 1px;
|
|
}
|
|
|
|
.kv-flag {
|
|
font-size: var(--text-xs);
|
|
color: var(--warn);
|
|
background: var(--warn-soft);
|
|
border-radius: var(--radius-pill);
|
|
padding: 1px var(--sp-2);
|
|
flex: none;
|
|
}
|
|
|
|
.kv-input {
|
|
font: inherit;
|
|
font-size: var(--text-sm);
|
|
color: var(--fg);
|
|
background: var(--bg, var(--surface));
|
|
border: 1px solid var(--border-strong);
|
|
border-radius: var(--radius-sm);
|
|
padding: var(--sp-1) var(--sp-2);
|
|
min-width: 0;
|
|
width: 100%;
|
|
}
|
|
|
|
.kv-input:focus {
|
|
outline: 2px solid var(--accent);
|
|
outline-offset: -1px;
|
|
}
|
|
|
|
.kv-save,
|
|
.kv-cancel {
|
|
font: inherit;
|
|
font-size: var(--text-xs);
|
|
border-radius: var(--radius-sm);
|
|
padding: var(--sp-1) var(--sp-2);
|
|
cursor: pointer;
|
|
flex: none;
|
|
}
|
|
|
|
.kv-save {
|
|
background: var(--accent);
|
|
border: 1px solid var(--accent);
|
|
color: var(--accent-fg);
|
|
font-weight: 500;
|
|
}
|
|
|
|
.kv-save:disabled {
|
|
opacity: 0.6;
|
|
cursor: default;
|
|
}
|
|
|
|
.kv-cancel {
|
|
background: transparent;
|
|
border: 1px solid var(--border-strong);
|
|
color: var(--fg-muted);
|
|
}
|
|
|
|
.kv-cancel:hover {
|
|
color: var(--fg);
|
|
}
|
|
|
|
.cfg-notice {
|
|
border-left: 3px solid var(--warn);
|
|
}
|
|
|
|
.cfg-notice p {
|
|
margin: 0;
|
|
font-size: var(--text-sm);
|
|
color: var(--warn);
|
|
}
|
|
|
|
/* Narrow viewports: stack label over value so neither has to truncate to a
|
|
few characters. Actions move onto the label line to keep the row compact. */
|
|
@media (max-width: 700px) {
|
|
/* Drop out of subgrid: a shared label column is the wrong shape once the
|
|
row stacks, and a row still adopting the list's three tracks would place
|
|
its stacked children into columns that no longer exist. */
|
|
.kv-list {
|
|
display: flex;
|
|
flex-direction: column;
|
|
width: auto;
|
|
}
|
|
|
|
.kv {
|
|
grid-template-columns: minmax(0, 1fr) auto;
|
|
column-gap: var(--sp-4);
|
|
}
|
|
|
|
.kv-label {
|
|
grid-column: 1;
|
|
}
|
|
|
|
.kv-actions {
|
|
grid-column: 2;
|
|
grid-row: 1;
|
|
}
|
|
|
|
.kv-value,
|
|
.kv-note {
|
|
grid-column: 1 / -1;
|
|
white-space: normal;
|
|
overflow-wrap: anywhere;
|
|
}
|
|
}
|