DEVELOPMENT ENVIRONMENT

~liljamo/felu

ref: 4992844348f2ecabf096daf60a71f737a928683a felu/internal/components/base.templ -rw-r--r-- 1.3 KiB
49928443Jonni Liljamo docs: update README.md 23 hours ago
                                                                                
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
package components

import "git.src.quest/~liljamo/felu/internal/config"

func serviceName() string {
	return config.FeluConfig.ServiceName
}

templ BaseBase(title string) {
	<!DOCTYPE html>
	<html>
		<head>
			<meta charset="utf-8"/>
			<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
			<link rel="stylesheet" type="text/css" href="/static/styles.css"/>

			<script src="/static/htmx.min.js"></script>

			<title>{ title }</title>
		</head>
		<body>
			<main>
				{ children... }
			</main>
			<script src="/static/felu.js"></script>
		</body>
	</html>
}

templ Base(title string) {
	@BaseBase(title) {
		<div class="flex flex-col w-full items-center p-4">
			<div class="flex flex-col items-center gap-4">
				<a class="text-4xl" href="/">{ serviceName() }</a>
			</div>
			<div class="flex flex-col w-full max-w-5xl items-center gap-2">
				{ children... }
			</div>
		</div>
	}
}

templ ManageBase(title string) {
	@BaseBase(title) {
		<div class="flex flex-col w-full items-center p-4">
			<div class="flex w-full max-w-5xl items-center gap-4">
				<a href="/manage">{ serviceName() }</a>
				<a class="border p-1" href="/manage/user">User Settings</a>
				<button class="border p-1" hx-get="/auth/logout">Logout</button>
			</div>
			<div class="flex flex-col w-full max-w-5xl items-center gap-2">
				{ children... }
			</div>
		</div>
	}
}