aboutsummaryrefslogtreecommitdiff
path: root/src/lib/components/Nav.svelte
blob: f6c83fcf74eb03a108f07373efdcfee6c542e385 (plain) (blame)
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

<script lang="ts">
	import { page } from '$app/stores';
</script>

<nav class="navbar">
	<a href="/" class:active={$page.url.pathname === '/'}>List</a>
	<a href="/catalog" class:active={$page.url.pathname === '/catalog'}>Catalog</a
	>
	<a href="/categories" class:active={$page.url.pathname === '/categories'}
		>Categories</a
	>
</nav>

<style>
	.navbar {
		display: flex;
		gap: 0.25rem;
		padding: 0.5rem 0;
		border-bottom: 1px solid #ddd;
		position: sticky;
		top: 0;
		background: #fafafa;
		z-index: 20;
	}

	.navbar a {
		padding: 0.5rem 1rem;
		border-radius: 0.5rem;
		color: #333;
		text-decoration: none;
		font-size: 0.875rem;
		transition: background 0.15s;
	}

	.navbar a:hover {
		background: #f5f5f5;
	}

	.navbar a.active {
		background: #333;
		color: #fff;
	}
</style>