1
0
Fork 0
mirror of https://github.com/sussy-code/smov.git synced 2024-12-29 16:07:40 +01:00

autocompletion

This commit is contained in:
mrjvs 2023-11-22 17:00:14 +01:00
parent f3146b9a00
commit 2def74cb32
4 changed files with 41 additions and 25 deletions

View file

@ -3,6 +3,8 @@ import { TextInputControl } from "./TextInputControl";
export function AuthInputBox(props: { export function AuthInputBox(props: {
value?: string; value?: string;
label?: string; label?: string;
name?: string;
autoComplete?: string;
placeholder?: string; placeholder?: string;
onChange?: (data: string) => void; onChange?: (data: string) => void;
}) { }) {
@ -12,7 +14,9 @@ export function AuthInputBox(props: {
<p className="font-bold text-white">{props.label}</p> <p className="font-bold text-white">{props.label}</p>
) : null} ) : null}
<TextInputControl <TextInputControl
name={props.name}
value={props.value} value={props.value}
autoComplete={props.autoComplete}
onChange={props.onChange} onChange={props.onChange}
placeholder={props.placeholder} placeholder={props.placeholder}
className="w-full flex-1 bg-authentication-inputBg px-4 py-3 text-search-text focus:outline-none rounded-lg placeholder:text-gray-700" className="w-full flex-1 bg-authentication-inputBg px-4 py-3 text-search-text focus:outline-none rounded-lg placeholder:text-gray-700"

View file

@ -3,6 +3,8 @@ export interface TextInputControlPropsNoLabel {
onUnFocus?: () => void; onUnFocus?: () => void;
onFocus?: () => void; onFocus?: () => void;
value?: string; value?: string;
name?: string;
autoComplete?: string;
placeholder?: string; placeholder?: string;
className?: string; className?: string;
} }
@ -16,6 +18,8 @@ export function TextInputControl({
onUnFocus, onUnFocus,
value, value,
label, label,
name,
autoComplete,
className, className,
placeholder, placeholder,
onFocus, onFocus,
@ -27,6 +31,8 @@ export function TextInputControl({
placeholder={placeholder} placeholder={placeholder}
onChange={(e) => onChange && onChange(e.target.value)} onChange={(e) => onChange && onChange(e.target.value)}
value={value} value={value}
name={name}
autoComplete={autoComplete}
onBlur={() => onUnFocus && onUnFocus()} onBlur={() => onUnFocus && onUnFocus()}
onFocus={() => onFocus?.()} onFocus={() => onFocus?.()}
/> />

View file

@ -58,6 +58,8 @@ export function LoginFormPart(props: LoginFormPartProps) {
<AuthInputBox <AuthInputBox
label="12-Word Passphrase" label="12-Word Passphrase"
value={mnemonic} value={mnemonic}
autoComplete="username"
name="username"
onChange={setMnemonic} onChange={setMnemonic}
placeholder="Passphrase" placeholder="Passphrase"
/> />

View file

@ -82,32 +82,36 @@ export function VerifyPassphrase(props: VerifyPassphraseProps) {
return ( return (
<LargeCard> <LargeCard>
<LargeCardText <form>
icon={<Icon icon={Icons.CIRCLE_CHECK} />} <LargeCardText
title="Enter your passphrase" icon={<Icon icon={Icons.CIRCLE_CHECK} />}
> title="Enter your passphrase"
If you&apos;ve already lost it, how will you ever be able to take care
of a child?
</LargeCardText>
<AuthInputBox
label="Your passphrase"
value={mnemonic}
onChange={setMnemonic}
/>
{result.error ? (
<p className="mt-3 text-authentication-errorText">
{result.error.message}
</p>
) : null}
<LargeCardButtons>
<Button
theme="purple"
loading={result.loading}
onClick={() => execute(mnemonic)}
> >
Register If you&apos;ve already lost it, how will you ever be able to take care
</Button> of a child?
</LargeCardButtons> </LargeCardText>
<AuthInputBox
label="Your passphrase"
autoComplete="username"
name="username"
value={mnemonic}
onChange={setMnemonic}
/>
{result.error ? (
<p className="mt-3 text-authentication-errorText">
{result.error.message}
</p>
) : null}
<LargeCardButtons>
<Button
theme="purple"
loading={result.loading}
onClick={() => execute(mnemonic)}
>
Register
</Button>
</LargeCardButtons>
</form>
</LargeCard> </LargeCard>
); );
} }