84 | If you don't have an account, please 85 | 86 | Sign up 87 | 88 |
89 | 90 | ); 91 | }; 92 | 93 | export default SignInForm; 94 | -------------------------------------------------------------------------------- /src/components/form/SignUpForm.tsx: -------------------------------------------------------------------------------- 1 | 'use client'; 2 | 3 | import { useForm } from 'react-hook-form'; 4 | import { 5 | Form, 6 | FormControl, 7 | FormField, 8 | FormItem, 9 | FormLabel, 10 | FormMessage, 11 | } from '../ui/form'; 12 | import * as z from 'zod'; 13 | import { zodResolver } from '@hookform/resolvers/zod'; 14 | import { Input } from '../ui/input'; 15 | import { Button } from '../ui/button'; 16 | import Link from 'next/link'; 17 | import GoogleSignInButton from '../GoogleSignInButton'; 18 | 19 | const FormSchema = z 20 | .object({ 21 | username: z.string().min(1, 'Username is required').max(100), 22 | email: z.string().min(1, 'Email is required').email('Invalid email'), 23 | password: z 24 | .string() 25 | .min(1, 'Password is required') 26 | .min(8, 'Password must have than 8 characters'), 27 | confirmPassword: z.string().min(1, 'Password confirmation is required'), 28 | }) 29 | .refine((data) => data.password === data.confirmPassword, { 30 | path: ['confirmPassword'], 31 | message: 'Password do not match', 32 | }); 33 | 34 | const SignUpForm = () => { 35 | const form = useForm123 | If you don't have an account, please 124 | 125 | Sign in 126 | 127 |
128 | 129 | ); 130 | }; 131 | 132 | export default SignUpForm; 133 | -------------------------------------------------------------------------------- /src/components/ui/button.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react" 2 | import { Slot } from "@radix-ui/react-slot" 3 | import { cva, type VariantProps } from "class-variance-authority" 4 | 5 | import { cn } from "@/lib/utils" 6 | 7 | const buttonVariants = cva( 8 | "inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50", 9 | { 10 | variants: { 11 | variant: { 12 | default: "bg-primary text-primary-foreground hover:bg-primary/90", 13 | destructive: 14 | "bg-destructive text-destructive-foreground hover:bg-destructive/90", 15 | outline: 16 | "border border-input bg-background hover:bg-accent hover:text-accent-foreground", 17 | secondary: 18 | "bg-secondary text-secondary-foreground hover:bg-secondary/80", 19 | ghost: "hover:bg-accent hover:text-accent-foreground", 20 | link: "text-primary underline-offset-4 hover:underline", 21 | }, 22 | size: { 23 | default: "h-10 px-4 py-2", 24 | sm: "h-9 rounded-md px-3", 25 | lg: "h-11 rounded-md px-8", 26 | icon: "h-10 w-10", 27 | }, 28 | }, 29 | defaultVariants: { 30 | variant: "default", 31 | size: "default", 32 | }, 33 | } 34 | ) 35 | 36 | export interface ButtonProps 37 | extends React.ButtonHTMLAttributes157 | {body} 158 |
159 | ); 160 | }); 161 | FormMessage.displayName = 'FormMessage'; 162 | 163 | export { 164 | useFormField, 165 | Form, 166 | FormItem, 167 | FormLabel, 168 | FormControl, 169 | FormDescription, 170 | FormMessage, 171 | FormField, 172 | }; 173 | -------------------------------------------------------------------------------- /src/components/ui/input.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react" 2 | 3 | import { cn } from "@/lib/utils" 4 | 5 | export interface InputProps 6 | extends React.InputHTMLAttributes