Skip to content

Better submit buttons#97

Merged
naps62 merged 8 commits into
mainfrom
better-submit
Jun 25, 2025
Merged

Better submit buttons#97
naps62 merged 8 commits into
mainfrom
better-submit

Conversation

@naps62

@naps62 naps62 commented Jun 25, 2025

Copy link
Copy Markdown
Member

Targeting this issue from the main repo: ethui/ethui#1229

overall changes:

  • the icon now switches between a spinner (during submission), a check (when a valid submission was made) and a floppy disk (when the form is dirty)
  • the button still shows as disabled when the form is either not dirty or invalid
  • labels for all 3 states are now required

Copilot AI review requested due to automatic review settings June 25, 2025 10:48
@vercel

vercel Bot commented Jun 25, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
ethui-ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 25, 2025 11:13am

@naps62 naps62 added the enhancement New feature or request label Jun 25, 2025
@naps62
naps62 requested a review from joaocosta9 June 25, 2025 10:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances the Form.Submit component to display different icons and labels based on submission state (submitting, success, dirty) and updates related stories.

  • Add Save icon and new props (submittingLabel, successLabel) for dynamic labels
  • Update Submit logic to compute icon and label based on isSubmitting, isDirty, and isSubmitSuccessful
  • Provide new stories demonstrating the required and optional input forms with the updated submit behavior

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
stories/forms/Submit.stories.tsx Add stories to showcase Form.Submit states and pass appropriate args
components/form.tsx Update Submit component: import Save, add dynamic icon/label logic, define new props
Comments suppressed due to low confidence (3)

components/form.tsx:261

  • [nitpick] The new props submittingLabel and successLabel are optional, but the PR description states labels for all states are required. To align the API with the documentation, consider making these props required.
}: SubmitProps) {

components/form.tsx:259

  • [nitpick] Using the prop name isSubmitting for an override is confusing since formState.isSubmitting exists. Renaming the prop to e.g. isLoading or submittingOverride would improve clarity.
  isSubmitting: isSubmittingOverride = false,

components/form.tsx:268

  • There are no existing tests covering the new Submit states (submitting, success, dirty). Consider adding tests to validate icon and label changes across these states.
  const disabled = skipDirtyCheck

Comment thread components/form.tsx Outdated
Comment thread components/form.tsx Outdated
Comment thread stories/forms/Submit.stories.tsx Outdated
naps62 and others added 4 commits June 25, 2025 12:04
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@naps62
naps62 merged commit a6ce255 into main Jun 25, 2025
4 checks passed
@naps62
naps62 deleted the better-submit branch June 25, 2025 11:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants