Watch
0
0
Fork
You've already forked hyperhive
0

swarm-ui: FieldGrid lays out a row of form fields on one grid for the forms that each hand-rolled it

Classifier settings, the try-out target row and classification rows, and the
schedule cadence each wrote their own flex row with its own flex basis and
gap. FieldGrid is one grid with equal columns and one gap, FieldGridFull
spans a row, and the four forms use it, so a lone last field keeps its column
width and the columns share their edges in every row.
This commit is contained in:
iris 2026-11-06 19:53:31 +01:00 • committed by mara
commit a9dd276935
3 changed files with 99 additions and 57 deletions

View file

@ -2,6 +2,7 @@
// description (the prompt the model answers), which answer passes, and how
// certain the model has to be for its answer to count.
import { Button } from "../../ui/button/Button.js";
import { FieldGrid } from "../../ui/field-grid/FieldGrid.js";
import { SelectField } from "../../ui/select-field/SelectField.js";
import { TextAreaField } from "../../ui/text-area-field/TextAreaField.js";
import { TextField } from "../../ui/text-field/TextField.js";
@ -41,7 +42,7 @@ export function ClassificationEditor({
placeholder="what to look for in the PR, e.g. does it add a naive datetime?"
onInput={(description) => onChange({ ...draft, description })}
/>
<div class="ui-tryout-classification-row">
<FieldGrid min="12em" class="ui-tryout-classification-row">
<SelectField
id={`${id}-polarity`}
label="polarity"
@ -59,7 +60,7 @@ export function ClassificationEditor({
onInput={(threshold) => onChange({ ...draft, threshold })}
/>
{onRemove ? <Button onClick={onRemove}>remove</Button> : null}
</div>
</FieldGrid>
</div>
);
}

View file

@ -12,17 +12,10 @@
gap: 1em;
margin-top: 1em;
}
.ui-tryout-target {
display: flex;
flex-wrap: wrap;
gap: 0.75em;
}
.ui-tryout-target > * {
flex: 1 1 14em;
}
/* The button sits at the foot of its cell, beside the inputs. */
.ui-tryout-target > button {
flex: none;
align-self: flex-end;
align-self: end;
justify-self: start;
}
.ui-tryout-loaded {
margin: 0;
@ -37,16 +30,10 @@
border-radius: 0.5em;
}
.ui-tryout-classification-row {
display: flex;
flex-wrap: wrap;
align-items: flex-end;
gap: 0.75em;
}
.ui-tryout-classification-row > * {
flex: 1 1 12em;
align-items: end;
}
.ui-tryout-classification-row > button {
flex: none;
justify-self: start;
}
.ui-tryout-hint {
margin: 0;

View file

@ -27,6 +27,7 @@ import { ApiErrorPanel } from "@hive/shared/api-error-panel.js";
import { readApiError, type ProblemDetails } from "@hive/shared/api-error.js";
import { ActionRow } from "../../ui/action-row/ActionRow.js";
import { Button } from "../../ui/button/Button.js";
import { FieldGrid } from "../../ui/field-grid/FieldGrid.js";
import { ConfirmDialog } from "../../ui/confirm-dialog/ConfirmDialog.js";
import { Disclosure } from "../../ui/disclosure/Disclosure.js";
import { ExternalLink } from "../../ui/external-link/ExternalLink.js";
@ -332,7 +333,7 @@ export function ReviewTryOut() {
the repo's rules.
</p>
<form class="ui-tryout-form" onSubmit={(e) => void run(e)}>
<div class="ui-tryout-target">
<FieldGrid class="ui-tryout-target">
<TextField
id="tryout-repo"
label="repo"
@ -358,7 +359,7 @@ export function ReviewTryOut() {
>
{loadingRules ? "loading…" : "load the repo's rules"}
</Button>
</div>
</FieldGrid>
{repoChoicesError ? (
<ApiErrorPanel
context="the repos with an open PR could not be listed"