summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
Diffstat (limited to 'components')
-rw-r--r--components/auth.html21
-rw-r--r--components/index.html7
2 files changed, 27 insertions, 1 deletions
diff --git a/components/auth.html b/components/auth.html
new file mode 100644
index 0000000..78ad338
--- /dev/null
+++ b/components/auth.html
@@ -0,0 +1,21 @@
+{{define "auth"}}
+<div id="logindiv">
+ <form class="space-y-6" hx-post="/login" hx-target="#ancestor" hx-swap="outerHTML">
+ <div>
+ <label For="username" class="block text-sm font-medium leading-6 text-white-900">username</label>
+ <div class="mt-2">
+ <input id="username" name="username" autocomplete="username" class="rounded-md text-center text-black" required />
+ </div>
+ </div>
+ <div>
+ <label For="room_pass" class="block text-sm font-medium leading-6 text-white-900">password</label>
+ <div class="mt-2">
+ <input id="password" name="password" type="password" required class="rounded-md text-center text-black" />
+ </div>
+ </div>
+ <div>
+ <button type="submit" class="justify-center rounded-md bg-indigo-600 px-3 py-1.5 text-sm font-semibold leading-6 text-white shadow-sm hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600">Sign in</button>
+ </div>
+ </form>
+</div>
+{{end}}
diff --git a/components/index.html b/components/index.html
index b3da4ea..3693a56 100644
--- a/components/index.html
+++ b/components/index.html
@@ -10,13 +10,18 @@
</head>
<body>
<div id="ancestor">
- <hr />
+ {{ if not . }}
+ <div>
+ {{ template "auth" }}
+ </div>
+ {{ else }}
<div>
{{ template "UserScore" . }}
</div>
<div>
{{ template "showformbtn" }}
</div>
+ {{ end }}
</div>
</body>
</html>