Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/** @jsxImportSource https://esm.sh/hono@latest/jsx */
export default function LoginModal() {
return (
<>
<div id="login-modal" className="z-100 fixed inset-0 flex items-center justify-center bg-black bg-opacity-50 animate-fadeIn">
<div className="bg-white rounded-lg shadow-xl p-8 w-full max-w-md mx-4 mt-4 mb-0">
<div className="flex flex-col gap-1 mb-4">
<h2 className="text-xl font-bold ">Login to Your Profile</h2>
<p className="text-sm text-neutral-800">
No account?{' '}
<a
hx-get="/signupModal"
hx-target="#login-modal"
hx-swap="outerHTML"
className="text-blue-500 hover:underline cursor-pointer"
onclick="document.getElementById('login-modal').style.display='none';"
>
Create one
</a>
</p>
</div>
<form action="/login" method="post" className="flex flex-col gap-4">
<div>
<label htmlFor="username" className="text-md font-medium text-neutral-800">Username</label>
<input id="username" type="text" name="username" placeholder="Username" required className="mt-1 w-full px-4 py-2 border rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500" />
</div>
<div>
<label htmlFor="password" className="text-md font-medium text-neutral-800">Password</label>
<input id="password" type="password" name="password" placeholder="Password" required className="mt-1 w-full px-4 py-2 border rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500" />
</div>
<button type="submit" className="w-full bg-blue-100 border-2 py-2 mt-2 border-blue-700 rounded-md font-bold text-blue-900 uppercase tracking-wider hover:bg-blue-200">
Login
</button>
</form>
<button onclick="document.getElementById('login-modal').style.display='none';" className="py-2 w-full bg-red-100 border-2 border-red-700 rounded-md font-bold text-red-900 uppercase tracking-wider hover:bg-red-200">
Close
</button>
</div>
</div>
</>
);
}
May 22, 2024