72 lines
1.9 KiB
TypeScript
72 lines
1.9 KiB
TypeScript
"use client"
|
||
|
||
import { useState } from "react"
|
||
import { Button } from "@/components/ui/button"
|
||
import { Input } from "@/components/ui/input"
|
||
import { Label } from "@/components/ui/label"
|
||
import Link from "next/link"
|
||
|
||
export function RegisterForm() {
|
||
const [formData, setFormData] = useState({
|
||
email: "",
|
||
password: "",
|
||
confirmPassword: "",
|
||
})
|
||
|
||
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
||
const { name, value } = e.target
|
||
setFormData(prev => ({ ...prev, [name]: value }))
|
||
}
|
||
|
||
const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {
|
||
e.preventDefault()
|
||
// Here you would typically send the data to your backend
|
||
console.log("Form submitted:", formData)
|
||
}
|
||
|
||
return (
|
||
<form onSubmit={handleSubmit} className="space-y-4 max-w-md mx-auto">
|
||
<div>
|
||
<Label htmlFor="email">Email</Label>
|
||
<Input
|
||
type="email"
|
||
id="email"
|
||
name="email"
|
||
value={formData.email}
|
||
onChange={handleChange}
|
||
required
|
||
/>
|
||
</div>
|
||
<div>
|
||
<Label htmlFor="password">Пароль</Label>
|
||
<Input
|
||
type="password"
|
||
id="password"
|
||
name="password"
|
||
value={formData.password}
|
||
onChange={handleChange}
|
||
required
|
||
/>
|
||
</div>
|
||
<div>
|
||
<Label htmlFor="confirmPassword">Подтвердите пароль</Label>
|
||
<Input
|
||
type="password"
|
||
id="confirmPassword"
|
||
name="confirmPassword"
|
||
value={formData.confirmPassword}
|
||
onChange={handleChange}
|
||
required
|
||
/>
|
||
</div>
|
||
<Button type="submit" className="w-full">Зарегистрироваться</Button>
|
||
<div className="text-center">
|
||
<Link href="/recover-password" className="text-blue-600 hover:underline">
|
||
Забыли пароль?
|
||
</Link>
|
||
</div>
|
||
</form>
|
||
)
|
||
}
|
||
|