From a33bf167d416b263b1c19b8e2fad0a6bdb053a65 Mon Sep 17 00:00:00 2001 From: cfngc4594 Date: Tue, 18 Mar 2025 22:14:12 +0800 Subject: [PATCH] rename(components): update file names for consistency --- ...-sign-in.tsx => credentials-sign-in-form.tsx} | 16 +++++++++------- ...-sign-up.tsx => credentials-sign-up-form.tsx} | 16 +++++++++------- ...ithub-sign-in.tsx => github-sign-in-form.tsx} | 2 +- src/components/sign-in-form.tsx | 10 +++++----- src/components/sign-up-form.tsx | 12 ++++++------ 5 files changed, 30 insertions(+), 26 deletions(-) rename src/components/{credentials-sign-in.tsx => credentials-sign-in-form.tsx} (89%) rename src/components/{credentials-sign-up.tsx => credentials-sign-up-form.tsx} (89%) rename src/components/{github-sign-in.tsx => github-sign-in-form.tsx} (96%) diff --git a/src/components/credentials-sign-in.tsx b/src/components/credentials-sign-in-form.tsx similarity index 89% rename from src/components/credentials-sign-in.tsx rename to src/components/credentials-sign-in-form.tsx index 4213154..0706abd 100644 --- a/src/components/credentials-sign-in.tsx +++ b/src/components/credentials-sign-in-form.tsx @@ -18,8 +18,10 @@ import { zodResolver } from "@hookform/resolvers/zod"; import { signInWithCredentials } from "@/app/actions/auth"; import { EyeIcon, EyeOffIcon, MailIcon } from "lucide-react"; -export function CredentialsSignIn() { - const form = useForm>({ +export type CredentialsSignInFormValues = z.infer; + +export function CredentialsSignInForm() { + const form = useForm({ resolver: zodResolver(authSchema), defaultValues: { email: "", @@ -28,15 +30,15 @@ export function CredentialsSignIn() { }); const [isVisible, setIsVisible] = useState(false); - const toggleVisibility = () => setIsVisible((prevState) => !prevState); + const onSubmit = async (data: CredentialsSignInFormValues) => { + await signInWithCredentials(data); + }; + return (
- signInWithCredentials(data))} - className="grid gap-6" - > + >({ +export type CredentialsSignUpFormValues = z.infer; + +export function CredentialsSignUpForm() { + const form = useForm({ resolver: zodResolver(authSchema), defaultValues: { email: "", @@ -28,15 +30,15 @@ export function CredentialsSignUp() { }); const [isVisible, setIsVisible] = useState(false); - const toggleVisibility = () => setIsVisible((prevState) => !prevState); + const onSubmit = async (data: CredentialsSignUpFormValues) => { + await signUpWithCredentials(data); + }; + return ( - signUpWithCredentials(data))} - className="grid gap-6" - > + { diff --git a/src/components/sign-in-form.tsx b/src/components/sign-in-form.tsx index 8a3e946..e4f2250 100644 --- a/src/components/sign-in-form.tsx +++ b/src/components/sign-in-form.tsx @@ -1,5 +1,5 @@ -import { GithubSignIn } from "@/components/github-sign-in"; -import { CredentialsSignIn } from "@/components/credentials-sign-in"; +import { GithubSignInForm } from "@/components/github-sign-in-form"; +import { CredentialsSignInForm } from "@/components/credentials-sign-in-form"; export function SignInForm() { return ( @@ -10,13 +10,13 @@ export function SignInForm() { Enter your email below to sign in to your account

- +
Or
- + - ) + ); } diff --git a/src/components/sign-up-form.tsx b/src/components/sign-up-form.tsx index 10e18ce..265e3a7 100644 --- a/src/components/sign-up-form.tsx +++ b/src/components/sign-up-form.tsx @@ -1,5 +1,5 @@ -import { GithubSignIn } from "@/components/github-sign-in"; -import { CredentialsSignUp } from "@/components/credentials-sign-up"; +import { GithubSignInForm } from "@/components/github-sign-in-form"; +import { CredentialsSignUpForm } from "@/components/credentials-sign-up-form"; export function SignUpForm() { return ( @@ -10,19 +10,19 @@ export function SignUpForm() { Enter your email below to sign up to your account

- +
Or
- +
- Already have an account? {" "} + Already have an account?{" "} Sign in
- ) + ); }