Visitar URL original
Add Custom File Input Hook by jbouder · Pull Request #263 · MetroStar/comet · GitHub
Skip to content

Add Custom File Input Hook - #263

Merged
jbouder merged 3 commits into
mainfrom
file-input-clearing
Sep 18, 2024
Merged

jbouder merged 3 commits into
mainfrom
file-input-clearing

Conversation

@jbouder

@jbouder jbouder commented Sep 17, 2024 •

Copy link
Copy Markdown
Contributor

The current implementation of the File Input, based on the USWDS implementation doesn't provide a simple way to clear files. This update adds a new useFileInput custom hook, with a clear function to support current needs.

Description

  • Added file input custom hook with clear function
  • Added file input story with clear button
  • Added base hook unit tests

Implementation is based on how USWDS currently clears the input when the files are changed here: https://github.com/uswds/uswds/blob/e6a8bb2670e00cbd57177eb8c19d34313b7a53bb/packages/usa-file-input/src/index.js#L259

Related Issue

Supports #262

Motivation and Context

  • Simplify clearing the File Input field

How Has This Been Tested?

  • Local Testing in Storybook
  • Beta Testing in Comet Starter App

Screenshots (if appropriate):

N/A

@jbouder jbouder added the enhancement New feature or request label Sep 17, 2024
@jbouder
jbouder marked this pull request as ready for review September 17, 2024 19:38

@kildre kildre 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.

Looks good. Left one comment

@kildre kildre 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.

Launch!

@jbouder
jbouder merged commit 04a646c into main Sep 18, 2024
@jbouder
jbouder deleted the file-input-clearing branch September 18, 2024 15:01
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.

2 participants