refactor(web): extract FormCard — shared add/create form shell (heading + error banner + busy submit) #281
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Cloonar/coding-lab#281
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Split out of umbrella #276 (frontend component reuse, follow-up to #275).
Nine add/create forms hand-roll the same card shell: a
.card.form-cardcontainer, an<h2>heading, anErrorBanner, a<form>with fields, and a primary submit button whose label swaps while busy ("Creating…" / "Create token"). Sites: the create-token and create-credential cards, AddRepo, NewIssue (which puts the classes on the<form>element itself), and the add-forms in the repo-settings Secrets, Imports, and Schedules sections. Each duplicates the busy-state wiring and error plumbing shape.Extract the shell into a shared component, keeping fields with the caller. The agent brief follows in a comment.
Agent Brief
Category: enhancement
Summary: Extract the add/create form card shell (card + heading + error banner + form + busy-aware submit) into a shared
FormCardcomponent and migrate the ~9 hand-rolled sites.Current behavior:
Every add/create form hand-rolls the same shell: a card container carrying the
form-cardclass, an<h2>heading, anErrorBannerfed by a local error signal, a<form>with the fields, and a primary submit button that is disabled while busy and swaps its label ("Creating…" vs "Create token"). Sites: the create-token and create-credential cards, AddRepo, NewIssue, and the add-forms in the repo-settings Secrets, Imports, and Schedules sections. NewIssue differs by putting the card classes directly on the<form>element.Desired behavior:
A shared component (suggested name
FormCard) owns the shell — heading, error banner wiring, form element with submit handling, and the primary submit button with idle/busy labels and disabled-while-busy behavior. Field markup stays with the caller as children. All the listed sites render through it. No visual change.Key interfaces:
FormCardcomponent in the shared components directory, colocated test in theSectionCardstyle. Suggested props: title, error message + dismiss handler (or equivalent), submit handler, busy flag, idle/busy submit labels, children (the fields)ErrorBanner— reused inside the shell, not modifiedform-cardCSS class remains the styling hook and is applied by the component after migration; whether the class lands on a wrapper or the form element is an implementation decision, as long as the rendered look of every site is unchanged (NewIssue has a test asserting on theform.form-cardshape — keep it meaningful)Acceptance criteria:
FormCardexists with a colocated testOut of scope: