diff --git a/package.json b/package.json index 20162ab..1c69432 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ "postcss": "8.4.28", "react": "18.2.0", "react-dom": "18.2.0", + "react-hook-form": "^7.46.1", "tailwind-merge": "^1.14.0", "tailwindcss": "3.3.3", "tailwindcss-animate": "^1.0.7", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0c2cf8e..f3c2f57 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -56,6 +56,9 @@ dependencies: react-dom: specifier: 18.2.0 version: 18.2.0(react@18.2.0) + react-hook-form: + specifier: ^7.46.1 + version: 7.46.1(react@18.2.0) tailwind-merge: specifier: ^1.14.0 version: 1.14.0 @@ -9536,6 +9539,15 @@ packages: react-is: 18.1.0 dev: true + /react-hook-form@7.46.1(react@18.2.0): + resolution: {integrity: sha512-0GfI31LRTBd5tqbXMGXT1Rdsv3rnvy0FjEk8Gn9/4tp6+s77T7DPZuGEpBRXOauL+NhyGT5iaXzdIM2R6F/E+w==} + engines: {node: '>=12.22.0'} + peerDependencies: + react: ^16.8.0 || ^17 || ^18 + dependencies: + react: 18.2.0 + dev: false + /react-inspector@6.0.2(react@18.2.0): resolution: {integrity: sha512-x+b7LxhmHXjHoU/VrFAzw5iutsILRoYyDq97EDYdFpPLcvqtEzk4ZSZSQjnFPbr5T57tLXnHcqFYoN1pI6u8uQ==} peerDependencies: diff --git a/src/components/lume/LumeIdentity.tsx b/src/components/lume/LumeIdentity.tsx index 3fd29f0..71e3567 100644 --- a/src/components/lume/LumeIdentity.tsx +++ b/src/components/lume/LumeIdentity.tsx @@ -1,6 +1,7 @@ // src/components/sign-in-with-lume.tsx import React, { useCallback, useMemo } from 'react'; import { AnimatePresence, Variant, motion } from 'framer-motion'; +import { useForm } from "react-hook-form"; import LumeLogoBg from '@/assets/lume-logo-bg.svg'; import { Button } from '@/components/ui/button'; @@ -68,20 +69,33 @@ const LumeIdentity: React.FC = ({ onSignIn, onSignUp }) => { const SeedPhraseForm = useMemo(() => { return { render({ phraseLength = 12 }: { phraseLength: number }) { - return
+ const { register, handleSubmit, formState: { errors } } = useForm(); + + const onSubmit = (data: any) => { + console.log(data); + }; + + return
{Array(phraseLength).fill(null).map((_, index) => { - return
- {/* TODO: Add Support for the real values, this should be its own component */} - {index + 1} -
+ const fieldName = `phrase${index}`; + return ( +
+ + {index + 1} +
) })} -
+ + }, index: Symbol('seed-phrase-form').toString() } }, []); - const [visibleComponent, setVisibleComponent] = React.useState(SubmitButton); + const [visibleComponent, setVisibleComponent] = React.useState(SubmitButton as { render: (props: Record) => React.ReactElement, index: string }); const isSubmitButtonInView = [SubmitButton.index].includes(visibleComponent.index) const isCreatingAccount = [SetupAccountKey.index, SeedPhraseForm.index].includes(visibleComponent.index)