blob: b78e9b501c8787642c2ddf5417ab553283c6381e (
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
71
72
73
74
75
76
77
|
package pages
templ baseWithHeader(header templ.Component) {
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/svg+xml" href="/static/favicon.svg" sizes="16x16 32x32 48x48">
<title>Kosten</title>
<link href="/static/custom.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
if header != nil {
@header
}
</head>
<body>
{ children... }
</body>
</html>
}
func base() templ.Component {
return baseWithHeader(nil)
}
templ navlink(path, descr string) {
<li class="nav-item">
<a class={"nav-link", templ.KV("active", isCurrPath(ctx, path))}
href={templ.URL(path)}>{descr}</a>
</li>
}
templ navlinks() {
@navlink("/categories", "Kategorien")
@navlink("/recur", "Regelmäßig")
}
templ navbar() {
/* different inline svgs */
<svg xmlns="http://www.w3.org/2000/svg" class="d-none">
<symbol id="search" viewBox="0 0 16 16">
<path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"></path>
</symbol>
</svg>
/* The Navbar */
<nav class="navbar sticky-top bg-dark-subtle navbar-expand-lg shadow mb-2">
<div class="container-fluid" >
<a class="navbar-brand" href="/">
<img src="/static/euro-money.svg" alt="Logo" width="32" height="32" class="d-inline-block"/> Kosten
</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav nav-underline me-auto">
@navlinks()
</ul>
<form class="d-flex" role="search">
<input class="form-control me-2" type="search" placeholder="Search" aria-label="Search">
<button class="btn btn-outline-dark" type="submit"><svg class="svg"><use xlink:href="#search"></use></svg></button>
</form>
</div>
</div>
</nav>
}
templ content() {
@base() {
@navbar()
<main class="container-lg">
{children...}
</main>
}
}
|