File size: 1,426 Bytes
0bd62e5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
71
72
73
74
75
76
77
78
79
80
<script lang="ts">
	import { page } from "$app/stores";
	import components from "$lib/component_json";

	const nav_items = Array.from(new Set(components.map((c) => c.name))).sort();
</script>

<header>
	<nav>
		<ul>
			{#each nav_items as nav_item}
				<li
					aria-current={$page.url.pathname === `/${nav_item}`
						? "page"
						: undefined}
				>
					<a href={`/${nav_item}`}>{nav_item}</a>
				</li>
			{/each}
		</ul>
	</nav>
</header>

<style>
	header {
		display: flex;
		justify-content: center;
	}

	nav {
		width: 100%;
		box-shadow: 0px 0px 3px 1px rgba(0, 0, 0, 0.1);
	}

	ul {
		width: 100%;
		position: relative;
		padding: 0;
		margin: 0;
		/* height: 3em; */
		display: flex;
		justify-content: center;
		overflow-y: scroll;
		flex-wrap: wrap;
		align-items: center;
		list-style: none;
		background: var(--background);
		background-size: contain;
		padding: 10px;
	}

	li {
		position: relative;
		height: 100%;
		padding: 5px 2px;
	}

	li[aria-current="page"] a {
		color: var(--color-theme-1);
	}

	nav a {
		display: flex;
		height: 100%;
		align-items: center;
		padding: 0 0.5rem;
		color: var(--color-text);
		font-weight: 700;
		font-size: 0.7rem;
		text-transform: uppercase;
		letter-spacing: 0.1em;
		text-decoration: none;
		transition: color 0.2s linear;
	}

	a:hover {
		color: var(--color-theme-1);
	}
</style>