gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-wallet-core] branch master updated: fix #7094


From: gnunet
Subject: [taler-wallet-core] branch master updated: fix #7094
Date: Wed, 24 Nov 2021 22:00:13 +0100

This is an automated email from the git hooks/post-receive script.

sebasjm pushed a commit to branch master
in repository wallet-core.

The following commit(s) were added to refs/heads/master by this push:
     new db49eac6 fix #7094
db49eac6 is described below

commit db49eac6a76897edfaa650a986777d84d6a0c149
Author: Sebastian <sebasjm@gmail.com>
AuthorDate: Wed Nov 24 18:00:03 2021 -0300

    fix #7094
---
 .../src/components/fields/TextInput.tsx            | 29 +++++++++++++++-------
 .../src/pages/home/SecretEditorScreen.tsx          |  1 +
 2 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/packages/anastasis-webui/src/components/fields/TextInput.tsx 
b/packages/anastasis-webui/src/components/fields/TextInput.tsx
index efa95d84..55643b4a 100644
--- a/packages/anastasis-webui/src/components/fields/TextInput.tsx
+++ b/packages/anastasis-webui/src/components/fields/TextInput.tsx
@@ -2,6 +2,7 @@ import { h, VNode } from "preact";
 import { useLayoutEffect, useRef, useState } from "preact/hooks";
 
 export interface TextInputProps {
+  inputType?: "text" | "number" | "multiline" | "password";
   label: string;
   grabFocus?: boolean;
   disabled?: boolean;
@@ -12,13 +13,22 @@ export interface TextInputProps {
   bind: [string, (x: string) => void];
 }
 
-export function TextInput(props: TextInputProps): VNode {
+const TextInputType = function ({ inputType, grabFocus, ...rest }: any): VNode 
{
   const inputRef = useRef<HTMLInputElement>(null);
   useLayoutEffect(() => {
-    if (props.grabFocus) {
+    if (grabFocus) {
       inputRef.current?.focus();
     }
-  }, [props.grabFocus]);
+  }, [grabFocus]);
+
+  return inputType === "multiline" ? (
+    <textarea {...rest} rows={5} ref={inputRef} style={{ height: "unset" }} />
+  ) : (
+    <input {...rest} type={inputType} ref={inputRef} />
+  );
+};
+
+export function TextInput(props: TextInputProps): VNode {
   const value = props.bind[0];
   const [dirty, setDirty] = useState(false);
   const showError = dirty && props.error;
@@ -33,21 +43,22 @@ export function TextInput(props: TextInputProps): VNode {
         )}
       </label>
       <div class="control has-icons-right">
-        <input
+        <TextInputType
+          inputType={props.inputType}
           value={value}
+          grabFocus={props.grabFocus}
           disabled={props.disabled}
           placeholder={props.placeholder}
           class={showError ? "input is-danger" : "input"}
-          onKeyPress={(e) => {
-            if (e.key === 'Enter' && props.onConfirm) {
-              props.onConfirm()
+          onKeyPress={(e: any) => {
+            if (e.key === "Enter" && props.onConfirm) {
+              props.onConfirm();
             }
           }}
-          onInput={(e) => {
+          onInput={(e: any) => {
             setDirty(true);
             props.bind[1]((e.target as HTMLInputElement).value);
           }}
-          ref={inputRef}
           style={{ display: "block" }}
         />
       </div>
diff --git a/packages/anastasis-webui/src/pages/home/SecretEditorScreen.tsx 
b/packages/anastasis-webui/src/pages/home/SecretEditorScreen.tsx
index 6d4ffbf8..ccef8b94 100644
--- a/packages/anastasis-webui/src/pages/home/SecretEditorScreen.tsx
+++ b/packages/anastasis-webui/src/pages/home/SecretEditorScreen.tsx
@@ -83,6 +83,7 @@ export function SecretEditorScreen(): VNode {
       </div>
       <div class="block">
         <TextInput
+          inputType="multiline"
           disabled={!!secretFile}
           onConfirm={goNextIfNoErrors}
           label="Enter the secret as text:"

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]