aboutsummaryrefslogtreecommitdiff
path: root/src/lib/Header.svelte
blob: a5ec702cb8167838b59ff36c1c5acc6b71227b93 (plain)
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<script lang="ts">
	import { goto } from '$app/navigation'

	export let backArrowHref = '/'
	let searchUserValue: string = ''
</script>

<header id="main-header">
	<a href={backArrowHref} class="back-arrow-anchor" aria-label="back">
		<svg class="back-arrow" height="33" width="23">
			<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"
		on:submit={e => {
			goto(`/player/${searchUserValue}`)
			e.preventDefault()
		}}
	>
		<input
			class="enter-username-input"
			type="text"
			placeholder="Enter username"
			name="user-search"
			autocomplete="off"
			autocorrect="off"
			autocapitalize="off"
			spellcheck="false"
			aria-label="Enter username"
			bind:value={searchUserValue}
		/>
	</form>
</header>

<style>
	header {
		background-color: var(--theme-background);
		box-shadow: 0 0 1em rgba(0, 0, 0, 0.8);
		padding: 0.5rem 10%;
	}

	.user-form {
		display: inline-block;
		text-align: center;
		font-size: 1.25rem;
		/* center the forms */
		margin: 0 auto;
		width: max-content;
	}

	.enter-username-input {
		box-shadow: none;
		/* add a slight shadow on the form in the index page */
		max-width: calc(90vw - 8em);
	}

	.back-arrow {
		float: left;
		transition: stroke 200ms;
		stroke: var(--theme-darker-text);
		margin-top: 0.4em;
		margin-right: 1em;
	}
	.back-arrow:hover {
		stroke: var(--theme-main-text);
	}
</style>