From fd86e17a5c2ff7b2d1ac2e70299756af84f71d22 Mon Sep 17 00:00:00 2001 From: songa Date: Sat, 20 Jul 2024 01:45:34 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20react-hook-form=20=ED=99=9C=EC=9A=A9?= =?UTF-8?q?=ED=95=9C=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20=ED=8F=BC=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/index.css | 14 +++++++- src/pages/LoginPage/LoginPage.tsx | 53 ++++++++++++++++++++++++++++--- 2 files changed, 62 insertions(+), 5 deletions(-) diff --git a/src/index.css b/src/index.css index 956920d45..59ec6341a 100644 --- a/src/index.css +++ b/src/index.css @@ -7,11 +7,23 @@ @apply text-secondary-100 bg-primary-100 hover:bg-primary-200 active:bg-primary-200 rounded-full h-[56px] cursor-pointer; } + .btn-disabled { + @apply bg-secondary-400 hover:bg-secondary-400 cursor-default; + } + .input { - @apply block bg-secondary-100 outline-primary-100 font-normal w-full h-14 mt-4 inner-p rounded; + @apply block bg-secondary-100 outline-none border border-secondary-100 focus:border-primary-100 font-normal w-full h-14 mt-4 inner-p rounded; + } + + .input-error { + @apply border-error-red focus:border-error-red; } .inner-p { @apply px-6 py-4; } + + .error-message { + @apply px-4 py-2 text-sm text-error-red font-semibold; + } } diff --git a/src/pages/LoginPage/LoginPage.tsx b/src/pages/LoginPage/LoginPage.tsx index 712a90d4f..9d99348c6 100644 --- a/src/pages/LoginPage/LoginPage.tsx +++ b/src/pages/LoginPage/LoginPage.tsx @@ -2,21 +2,66 @@ import logo from '../../assets/images/logo/logo.svg'; import googleIcon from '../../assets/images/icons/icon_google.svg'; import kakaoIcon from '../../assets/images/icons/icon_kakao.svg'; import { Link } from 'react-router-dom'; +import { useForm } from 'react-hook-form'; +import { SubmitHandler } from 'react-hook-form/dist/types'; + +type IFormInput = { + email: string; + password: string; +}; function LoginPage() { + const { + register, + handleSubmit, + formState: { errors, isValid, isSubmitting }, + } = useForm({ + mode: 'onChange', + }); + + // @TODO: POST 요청 구현 + const onSubmit: SubmitHandler = (data) => console.log(data); + return (
로고 -
+ - +

간편 로그인하기