41 lines
1.7 KiB
Haskell
41 lines
1.7 KiB
Haskell
|
|
module Web.View.Sessions.New where
|
||
|
|
|
||
|
|
import Web.Types
|
||
|
|
import Generated.Types
|
||
|
|
import IHP.Prelude
|
||
|
|
import IHP.ViewPrelude
|
||
|
|
|
||
|
|
data NewView = NewView { user :: !User }
|
||
|
|
|
||
|
|
instance View NewView where
|
||
|
|
html NewView { .. } = [hsx|
|
||
|
|
<div class="max-w-sm mx-auto mt-16">
|
||
|
|
<h1 class="text-2xl font-semibold mb-6">Sign in to inter-hub</h1>
|
||
|
|
<form method="POST" action={CreateSessionAction} class="space-y-4">
|
||
|
|
{forEach (getFlashMessages) renderFlash}
|
||
|
|
<div>
|
||
|
|
<label class="block text-sm font-medium text-gray-700 mb-1">Email</label>
|
||
|
|
<input type="email" name="email" required
|
||
|
|
class="w-full border border-gray-300 rounded px-3 py-2 text-sm
|
||
|
|
focus:outline-none focus:ring-2 focus:ring-indigo-500" />
|
||
|
|
</div>
|
||
|
|
<div>
|
||
|
|
<label class="block text-sm font-medium text-gray-700 mb-1">Password</label>
|
||
|
|
<input type="password" name="password" required
|
||
|
|
class="w-full border border-gray-300 rounded px-3 py-2 text-sm
|
||
|
|
focus:outline-none focus:ring-2 focus:ring-indigo-500" />
|
||
|
|
</div>
|
||
|
|
<button type="submit"
|
||
|
|
class="w-full bg-indigo-600 text-white rounded px-4 py-2 text-sm font-medium
|
||
|
|
hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500">
|
||
|
|
Sign in
|
||
|
|
</button>
|
||
|
|
</form>
|
||
|
|
</div>
|
||
|
|
|]
|
||
|
|
|
||
|
|
renderFlash :: Text -> Html
|
||
|
|
renderFlash msg = [hsx|
|
||
|
|
<div class="bg-red-50 border border-red-200 text-red-700 rounded px-3 py-2 text-sm">{msg}</div>
|
||
|
|
|]
|