feat: login form as a client component, theme toggle

This commit is contained in:
2025-07-17 16:49:46 +04:00
parent 0de352c323
commit 39b4d36a82
44 changed files with 14445 additions and 1 deletions

View File

@ -0,0 +1,66 @@
"use client";
import { FC } from "react";
import { redirect } from "next/navigation";
import { Button, Stack } from "@mantine/core";
import { useForm } from "@mantine/form";
import PhoneInput from "@/components/PhoneInput/PhoneInput";
type LoginForm = {
phoneNumber: string;
};
type Props = {
isCreatingId?: boolean;
};
const LoginForm: FC<Props> = ({ isCreatingId = false }) => {
const form = useForm<LoginForm>({
initialValues: {
phoneNumber: "",
},
});
const handleSubmit = (values: LoginForm) => {};
const navigateToCreateId = () => redirect("/create-id");
const navigateToLogin = () => redirect("/");
return (
<form onSubmit={form.onSubmit(handleSubmit)}>
<Stack w={350}>
<PhoneInput {...form.getInputProps("phoneNumber")} />
{isCreatingId ? (
<>
<Button
variant={"filled"}
type={"submit"}>
Создать аккаунт
</Button>
<Button
variant={"outline"}
onClick={() => navigateToLogin()}>
Уже есть LogiDex ID
</Button>
</>
) : (
<>
<Button
variant={"filled"}
type={"submit"}>
Войти
</Button>
<Button
variant={"outline"}
onClick={() => navigateToCreateId()}>
Создать LogiDex ID
</Button>
</>
)}
</Stack>
</form>
);
};
export default LoginForm;