-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
dcd6c7d
commit 3e22ea8
Showing
10 changed files
with
196 additions
and
156 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,19 @@ | ||
import { Ref, forwardRef } from 'react' | ||
|
||
import { PasswordInput, PasswordInputProps } from '@audius/harmony' | ||
import { useField } from 'formik' | ||
|
||
export type PasswordFieldProps = PasswordInputProps & { | ||
name: string | ||
} | ||
|
||
export const PasswordField = (props: PasswordFieldProps) => { | ||
const { name, ...other } = props | ||
const [field, { touched, error }] = useField(name) | ||
export const PasswordField = forwardRef( | ||
(props: PasswordFieldProps, ref: Ref<HTMLInputElement>) => { | ||
const { name, ...other } = props | ||
const [field, { touched, error }] = useField(name) | ||
|
||
const hasError = Boolean(touched && error) | ||
const hasError = Boolean(touched && error) | ||
|
||
return <PasswordInput {...field} error={hasError} {...other} /> | ||
} | ||
return <PasswordInput ref={ref} {...field} error={hasError} {...other} /> | ||
} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.