aboutsummaryrefslogtreecommitdiff
path: root/src/lib/components/Nav.svelte
blob: aa42aceb0aeb899caf915d5f7e98837cf1c40f48 (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
44
45
46
47
48
49
50
51
52
53
54

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

<nav class="navbar">
	<a href="/" class:active={$page.url.pathname === '/'}>Projets</a>
	<a href="/groceries" class:active={$page.url.pathname === '/groceries'}
		>Liste</a
	>
	<a
		href="/groceries/catalog"
		class:active={$page.url.pathname === '/groceries/catalog'}>Catalogue</a
	>
	<a
		href="/groceries/categories"
		class:active={$page.url.pathname === '/groceries/categories'}>Catégories</a
	>
</nav>

<style>
	.navbar {
		display: flex;
		gap: 0.25rem;
		border-bottom: 1px solid var(--border);
		position: sticky;
		top: 0;
		background: var(--bg);
		z-index: 20;
		height: var(--nav-height);
		align-items: center;
		padding: 0 1rem;
	}

	.navbar a {
		padding: 0.5rem 1rem;
		border-radius: 9999px;
		color: var(--text-secondary);
		text-decoration: none;
		font-size: 0.875rem;
		font-weight: 500;
		transition: all 0.2s ease;
	}

	.navbar a:hover {
		color: var(--text);
		background: var(--surface);
	}

	.navbar a.active {
		background: var(--accent);
		color: var(--white);
		box-shadow: 0 1px 2px var(--shadow);
	}
</style>