wip client to id

This commit is contained in:
2025-08-11 21:25:48 -03:00
parent 70e87e9526
commit 6e0e5f788d
13 changed files with 396 additions and 56 deletions

View File

@@ -1,5 +1,26 @@
import type { Route } from './+types/home'
import { isValidCPF } from '@brazilian-utils/brazilian-utils'
import { zodResolver } from '@hookform/resolvers/zod'
import { useForm } from 'react-hook-form'
import { z } from 'zod'
import { Button } from '@/components/ui/button'
import { Input } from '@/components/ui/input'
import { Label } from '@/components/ui/label'
import logo from './logo.svg'
const cpf = z.string().refine(isValidCPF, { message: 'CPF inválido' })
const email = z.string().email({ message: 'Email inválido' })
const schema = z.object({
username: z.union([cpf, email]),
password: z.string()
})
type Schema = z.infer<typeof schema>
export function meta({}: Route.MetaArgs) {
return [
{ title: 'EDUSEG®' },
@@ -12,9 +33,69 @@ export function loader({ context }: Route.LoaderArgs) {
}
export default function Home({ loaderData }: Route.ComponentProps) {
const { register, handleSubmit } = useForm({
resolver: zodResolver(schema)
})
const onSubmit = (data: Schema) => {
console.log(data)
}
return (
<>
<div>...</div>
<div className="w-full max-w-xs grid gap-6">
<div className="flex justify-center">
<div className="border border-white/15 bg-white/5 px-2.5 py-3 rounded-xl">
<img src={logo} alt="React Router" className="block size-12" />
</div>
</div>
<form onSubmit={handleSubmit(onSubmit)}>
<div className="grid gap-6">
<div className="text-center space-y-1.5">
<h1 className="text-2xl font-semibold font-display text-balance">
Faça login
</h1>
<p className="text-white/50 text-sm">
Não tem uma conta?{' '}
<a href="#" className="font-medium text-white">
Cadastre-se
</a>
.
</p>
</div>
<div className="grid gap-3">
<Label htmlFor="email">Email ou CPF</Label>
<Input id="email" type="text" required />
</div>
<div className="grid gap-3">
<div className="flex items-center">
<Label htmlFor="password">Senha</Label>
<a
href="#"
className="ml-auto text-sm underline-offset-4 hover:underline"
>
Esqueceu sua senha?
</a>
</div>
<Input id="password" type="password" required />
</div>
<Button type="submit" className="w-full bg-lime-400 cursor-pointer">
Entrar
</Button>
</div>
</form>
<p className="text-white/50 text-xs text-center">
Ao fazer login, você concorda com nossa{' '}
<a href="#" className="underline hover:no-underline">
política de privacidade
</a>
.
</p>
</div>
</>
)
}

View File

@@ -1,9 +1,20 @@
import { ChevronLeftIcon } from 'lucide-react'
import { Outlet } from 'react-router'
export default function Layout() {
return (
<div className="flex min-h-svh flex-col items-center justify-center">
<div className="w-full max-w-sm relative pt-12">
<div className="flex min-h-svh w-full items-center justify-center p-6 md:p-10 relative">
<a
href="//eduseg.com.br"
className="flex items-center gap-0.5 absolute top-5 left-5 text-sm z-1"
>
<ChevronLeftIcon className="size-5" /> Página incial
</a>
<div className="w-full max-w-sm relative z-1">
<Outlet />
</div>
<div className="w-full top-1/2 max-w-sm absolute pt-12 -translate-y-1/2">
<div
aria-hidden="true"
className="absolute inset-0 grid grid-cols-2 opacity-20"
@@ -12,10 +23,6 @@ export default function Layout() {
<div className="blur-[106px] h-42 bg-gradient-to-r from-lime-400 to-lime-600"></div>
</div>
</div>
<div>
<Outlet />
</div>
</div>
)
}

View File

@@ -0,0 +1 @@
<svg width="18" height="24" viewBox="0 0 18 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M16.2756 23.4353L8.93847 20.1298C8.7383 20.0015 8.48167 20.0015 8.27893 20.1298L0.941837 23.4353C0.533793 23.6945 0 23.4019 0 22.9194V1.12629C0.00256631 0.787535 0.277162 0.512939 0.615915 0.512939H16.6066C16.9454 0.512939 17.22 0.787535 17.22 1.12629V22.9194C17.22 23.4019 16.6862 23.6945 16.2781 23.4353H16.2756Z" fill="#8CD366"></path><path d="M10.7274 3.71313H3.34668V6.41803H10.7274V3.71313Z" fill="#2E3524"></path><path d="M9.42115 8.4939H3.34668V10.6496H9.42115V8.4939Z" fill="#2E3524"></path><path d="M10.7274 12.7263H3.34668V15.4312H10.7274V12.7263Z" fill="#2E3524"></path><path d="M12.9984 13.6731H12.9958C12.5111 13.6731 12.1182 14.066 12.1182 14.5508V14.5533C12.1182 15.0381 12.5111 15.431 12.9958 15.431H12.9984C13.4831 15.431 13.8761 15.0381 13.8761 14.5533V14.5508C13.8761 14.066 13.4831 13.6731 12.9984 13.6731Z" fill="#2E3524"></path></svg>

After

Width:  |  Height:  |  Size: 961 B