From e421ff5fe895bf75bd9379593d28b07c1df6d81e Mon Sep 17 00:00:00 2001
From: mat <github@matdoes.dev>
Date: Mon, 14 Feb 2022 23:59:17 -0600
Subject: search bar

---
 src/lib/Header.svelte | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

(limited to 'src/lib/Header.svelte')

diff --git a/src/lib/Header.svelte b/src/lib/Header.svelte
index 6ab7a33..27c7d09 100644
--- a/src/lib/Header.svelte
+++ b/src/lib/Header.svelte
@@ -1,7 +1,8 @@
 <script lang="ts">
-	import { enhance } from '$lib/form'
+	import { goto } from '$app/navigation'
 
 	export let backArrowHref = '/'
+	let searchUserValue: string = ''
 </script>
 
 <header id="main-header">
@@ -10,12 +11,15 @@
 			<path d="M 14 0 l -13 13 l 13 13" stroke-width="2" fill="none" />
 		</svg>
 	</a>
-	<form action="/player" method="post" class="user-form" use:enhance>
-		<!-- use:enhance={{
-			result: async ({ form }) => {
-				form.reset()
-			},
-		}} -->
+	<form
+		action="/player"
+		method="post"
+		class="user-form"
+		on:submit={e => {
+			goto(`/player/${searchUserValue}`)
+			e.preventDefault()
+		}}
+	>
 		<input
 			class="enter-username-button"
 			type="text"
@@ -26,6 +30,7 @@
 			autocapitalize="off"
 			spellcheck="false"
 			aria-label="Enter username"
+			bind:value={searchUserValue}
 		/>
 	</form>
 </header>
-- 
cgit 

