diff --git a/src/frontend/src/components/inputComponent/index.tsx b/src/frontend/src/components/inputComponent/index.tsx index 7adb029c3..5e3c5543c 100644 --- a/src/frontend/src/components/inputComponent/index.tsx +++ b/src/frontend/src/components/inputComponent/index.tsx @@ -1,3 +1,4 @@ +import * as Form from "@radix-ui/react-form"; import { useEffect, useState } from "react"; import { InputComponentType } from "../../types/components"; import { classNames } from "../../utils/utils"; @@ -7,6 +8,8 @@ export default function InputComponent({ value, onChange, disabled, + required = false, + isForm = false, password, editNode = false, placeholder = "Type something...", @@ -23,21 +26,47 @@ export default function InputComponent({ return (
- { - onChange(e.target.value); - }} - /> + {isForm ? ( + + { + onChange(e.target.value); + }} + /> + + ) : ( + { + onChange(e.target.value); + }} + /> + )} {password && ( - - -
- or
@@ -103,32 +91,26 @@ export default function LoginPage(): JSX.Element {
- + Password * - - { - handleInput({ target: { name: "password", value } }); - }} - value={password} - password={true} - placeholder="Password" - className="w-full" - /> - + { + handleInput({ target: { name: "password", value } }); + }} + value={password} + isForm + password={true} + required + placeholder="Password" + className="w-full" + /> Please enter your password - - {password === "" && ( - - Please enter a valid password - - )}
diff --git a/src/frontend/src/pages/signUpPage/index.tsx b/src/frontend/src/pages/signUpPage/index.tsx index 0fe5accc8..2f5e3f771 100644 --- a/src/frontend/src/pages/signUpPage/index.tsx +++ b/src/frontend/src/pages/signUpPage/index.tsx @@ -39,20 +39,8 @@ export default function SignUp(): JSX.Element {
⛓️ - Sign up to LangFlow + Sign up to Langflow -
- - - -
- or
@@ -81,18 +69,17 @@ export default function SignUp(): JSX.Element { Password * - - - { - handleInput({ target: { name: "password", value } }); - }} - value={password} - password={true} - placeholder="Password" - className="w-full" - /> - + { + handleInput({ target: { name: "password", value } }); + }} + value={password} + isForm + password={true} + required + placeholder="Password" + className="w-full" + /> Please enter a password @@ -115,15 +102,17 @@ export default function SignUp(): JSX.Element { * - - { - handleInput({ target: { name: "cnfPassword", value } }); - }} - value={cnfPassword} - password={true} - /> - + { + handleInput({ target: { name: "cnfPassword", value } }); + }} + value={cnfPassword} + isForm + password={true} + required + placeholder="Confirm your password" + className="w-full" + /> Please confirm your password diff --git a/src/frontend/src/types/components/index.ts b/src/frontend/src/types/components/index.ts index cd0844fb8..9dff35843 100644 --- a/src/frontend/src/types/components/index.ts +++ b/src/frontend/src/types/components/index.ts @@ -7,6 +7,8 @@ export type InputComponentType = { disabled?: boolean; onChange: (value: string) => void; password: boolean; + required?: boolean; + isForm?: boolean; editNode?: boolean; onChangePass?: (value: boolean | boolean) => void; showPass?: boolean;