blob: c5fcc60e9bc01e4d3883a42dcb89fd75fc132cf8 (
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
<script>
import { page } from '$app/stores';
</script>
<nav class="navbar">
<a href="/" data-label="Projets" class:active={$page.url.pathname === '/'}
><span>Projets</span></a
>
<a
href="/groceries"
data-label="Liste"
class:active={$page.url.pathname === '/groceries'}><span>Liste</span></a
>
<a
href="/groceries/catalog"
data-label="Catalogue"
class:active={$page.url.pathname === '/groceries/catalog'}
><span>Catalogue</span></a
>
<a
href="/groceries/categories"
data-label="Catégories"
class:active={$page.url.pathname === '/groceries/categories'}
><span>Catégories</span></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 {
height: 100%;
display: inline-grid;
align-content: center;
padding: 0 0.625rem;
font-size: 0.875rem;
color: var(--text-secondary);
text-decoration: none;
}
/* Bold ghost reserves the bold advance width in the same grid cell, so the
active tab's font-weight change never moves its siblings. */
.navbar a::before {
content: attr(data-label);
grid-area: 1 / 1;
visibility: hidden;
font-weight: 700;
}
.navbar a span {
grid-area: 1 / 1;
}
.navbar a:hover {
color: var(--text);
}
.navbar a.active {
color: var(--text);
}
.navbar a.active span {
font-weight: 700;
}
</style>
|