diff options
author | Sebastian <sebasjm@gmail.com> | 2022-10-26 14:50:50 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2022-10-26 14:52:52 -0300 |
commit | b4bad2deaf93eff5858d903cd68b8fdd5a5eecd3 (patch) | |
tree | e6ead0edbd2b56cf9bcd8bc312fb07ed9280c5cc /packages/demobank-ui/src/components/fields/EmailInput.tsx | |
parent | c34e71cf3de3da90d0d1662141aa1754a42ea37a (diff) | |
download | wallet-core-b4bad2deaf93eff5858d903cd68b8fdd5a5eecd3.tar.xz |
pretty
Diffstat (limited to 'packages/demobank-ui/src/components/fields/EmailInput.tsx')
-rw-r--r-- | packages/demobank-ui/src/components/fields/EmailInput.tsx | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/packages/demobank-ui/src/components/fields/EmailInput.tsx b/packages/demobank-ui/src/components/fields/EmailInput.tsx index 8b64264ed..2a22b26e8 100644 --- a/packages/demobank-ui/src/components/fields/EmailInput.tsx +++ b/packages/demobank-ui/src/components/fields/EmailInput.tsx @@ -1,5 +1,5 @@ -import { h, VNode } from 'preact'; -import { useLayoutEffect, useRef, useState } from 'preact/hooks'; +import { h, VNode } from "preact"; +import { useLayoutEffect, useRef, useState } from "preact/hooks"; export interface TextInputProps { label: string; @@ -14,9 +14,7 @@ export interface TextInputProps { export function EmailInput(props: TextInputProps): VNode { const inputRef = useRef<HTMLInputElement>(null); useLayoutEffect(() => { - if (props.grabFocus) - inputRef.current?.focus(); - + if (props.grabFocus) inputRef.current?.focus(); }, [props.grabFocus]); const value = props.bind[0]; const [dirty, setDirty] = useState(false); @@ -37,18 +35,16 @@ export function EmailInput(props: TextInputProps): VNode { required placeholder={props.placeholder} type="email" - class={showError ? 'input is-danger' : 'input'} + class={showError ? "input is-danger" : "input"} onKeyPress={(e) => { - if (e.key === 'Enter' && props.onConfirm) - props.onConfirm() - + if (e.key === "Enter" && props.onConfirm) props.onConfirm(); }} onInput={(e) => { setDirty(true); props.bind[1]((e.target as HTMLInputElement).value); }} ref={inputRef} - style={{ display: 'block' }} + style={{ display: "block" }} /> </div> {showError && <p class="help is-danger">{props.error}</p>} |