fix(edit): one field shape for the record settings popover

Every field now renders as a 150px label column plus a control column, so the
Featured checkbox no longer inherits the 220px text-input width and its row
shares the grid with Category/Location/Logo. Project section rows become a
5-column grid with named areas (id, type, up, down, remove) that reflows to
two rows at <=520px; the close button is a 28px target and inputs/selects get
the same :focus-visible ring as the rest of the edit chrome.
This commit is contained in:
dong.nguyen committed 2026-10-24 14:45:19 +07:00
1 parent ee3e85bf4a
commit 3126971852
2 files changed
+87 -10

No files matched your search

+84 -7
View File
@@ -2454,13 +2454,18 @@
} }
.record-settings-close { .record-settings-close {
display: inline-flex;
align-items: center;
justify-content: center;
width: 28px;
height: 28px;
padding: 0;
border: 1px solid var(--border); border: 1px solid var(--border);
border-radius: 4px; border-radius: 4px;
background: none; background: none;
color: var(--text-muted); color: var(--text-muted);
font-size: 16px; font-size: 16px;
line-height: 1; line-height: 1;
padding: 2px 8px;
cursor: pointer; cursor: pointer;
} }
@@ -2469,6 +2474,11 @@
border-color: var(--error); border-color: var(--error);
} }
.record-settings-close:focus-visible {
outline: 2px solid var(--accent);
outline-offset: 2px;
}
.record-settings-group-title { .record-settings-group-title {
font-size: 12px; font-size: 12px;
text-transform: uppercase; text-transform: uppercase;
@@ -2477,21 +2487,47 @@
margin: 12px 0 6px; margin: 12px 0 6px;
} }
/* One field shape for every panel: a label column and a control column, so a
checkbox, a select and a text input all start at the same x. The checkbox is
an 18px box in the control column — the old `min-width: 220px` applied to
every input, which made the featured checkbox 220px wide. */
.record-settings-field { .record-settings-field {
display: flex; display: grid;
grid-template-columns: 150px minmax(0, 1fr);
align-items: center; align-items: center;
gap: 8px; gap: 10px;
margin: 8px 0; margin: 8px 0;
} }
.record-settings-field input, .record-settings-field > span {
font-size: var(--text-meta);
color: var(--text-muted);
}
.record-settings-field input[type='text'],
.record-settings-field select { .record-settings-field select {
width: 100%;
min-width: 0;
background: var(--bg-surface); background: var(--bg-surface);
color: inherit; color: inherit;
border: 1px solid var(--border); border: 1px solid var(--border);
border-radius: 4px; border-radius: 4px;
padding: 4px 8px; padding: 4px 8px;
min-width: 220px; }
.record-settings-field input[type='checkbox'] {
width: 18px;
height: 18px;
margin: 0;
accent-color: var(--accent);
cursor: pointer;
}
.record-settings-field input:focus-visible,
.record-settings-field select:focus-visible,
.record-settings-row select:focus-visible {
outline: 2px solid var(--accent);
outline-offset: 2px;
} }
.record-settings-list { .record-settings-list {
@@ -2502,8 +2538,19 @@
padding: 0; padding: 0;
} }
/* The add control sits under the list it extends, not beside its last row. */
.record-settings .edit-add-inline {
margin-top: 8px;
}
/* A section row is a five-column grid — id | type | up | down | delete. The
control columns are fixed, so every id ellipsizes at the same x and every
select opens at the same x. Below the dialog's own width the type select
takes a row of its own and the controls stay on the id's row. */
.record-settings-row { .record-settings-row {
display: flex; display: grid;
grid-template-columns: minmax(0, 1fr) minmax(120px, 170px) repeat(3, 22px);
grid-template-areas: "id type up down remove";
align-items: center; align-items: center;
gap: 8px; gap: 8px;
border: 1px solid var(--border); border: 1px solid var(--border);
@@ -2512,6 +2559,9 @@
} }
.record-settings-row select { .record-settings-row select {
grid-area: type;
width: 100%;
min-width: 0;
background: var(--bg-surface); background: var(--bg-surface);
color: inherit; color: inherit;
border: 1px solid var(--border); border: 1px solid var(--border);
@@ -2519,13 +2569,40 @@
padding: 3px 6px; padding: 3px 6px;
} }
.record-settings-move-up {
grid-area: up;
}
.record-settings-move-down {
grid-area: down;
}
.record-settings-row .edit-record-remove {
grid-area: remove;
}
.record-settings-id { .record-settings-id {
grid-area: id;
font-size: 12px; font-size: 12px;
color: var(--text-muted); color: var(--text-muted);
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
max-width: 220px; min-width: 0;
}
@media (max-width: 520px) {
.record-settings-field {
grid-template-columns: 1fr;
gap: 4px;
}
.record-settings-row {
grid-template-columns: minmax(0, 1fr) repeat(3, 22px);
grid-template-areas:
"id up down remove"
"type type type type";
}
} }
/* Field-by-field conflict view (E8). */ /* Field-by-field conflict view (E8). */
+3 -3
View File
@@ -66,12 +66,12 @@ export function ProjectSettingsPanel({ project }: { project: ProjectStructure })
return ( return (
<> <>
<label className="record-settings-field"> <label className="record-settings-field">
<span>{s.edit.featured}</span>
<input <input
type="checkbox" type="checkbox"
checked={project.featured === true} checked={project.featured === true}
onChange={(event) => edit.setStructured('projects', `[${index}].featured`, event.target.checked)} onChange={(event) => edit.setStructured('projects', `[${index}].featured`, event.target.checked)}
/> />
{s.edit.featured}
</label> </label>
<label className="record-settings-field"> <label className="record-settings-field">
@@ -108,7 +108,7 @@ export function ProjectSettingsPanel({ project }: { project: ProjectStructure })
</select> </select>
<button <button
type="button" type="button"
className="edit-record-btn" className="edit-record-btn record-settings-move-up"
aria-label={`${s.edit.moveUp} — ${section.id}`} aria-label={`${s.edit.moveUp} — ${section.id}`}
disabled={i === 0} disabled={i === 0}
onClick={() => edit.moveItem('projects', `[${index}].sections`, i, i - 1)} onClick={() => edit.moveItem('projects', `[${index}].sections`, i, i - 1)}
@@ -117,7 +117,7 @@ export function ProjectSettingsPanel({ project }: { project: ProjectStructure })
</button> </button>
<button <button
type="button" type="button"
className="edit-record-btn" className="edit-record-btn record-settings-move-down"
aria-label={`${s.edit.moveDown} — ${section.id}`} aria-label={`${s.edit.moveDown} — ${section.id}`}
disabled={i === sections.length - 1} disabled={i === sections.length - 1}
onClick={() => edit.moveItem('projects', `[${index}].sections`, i, i + 1)} onClick={() => edit.moveItem('projects', `[${index}].sections`, i, i + 1)}