DEVELOPMENT ENVIRONMENT

~liljamo/emerwen-web

emerwen-web/internal/components/index.templ -rw-r--r-- 591 bytes
4e555b1eJonni Liljamo feat: UI for new/patch/delete worker/target a day ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package components

templ Index() {
	@Base("emerwen, counting sheep") {
		<div class="flex flex-col gap-2">
			if loggedIn(ctx) {
				@newWorker()
				<div hx-get="/partials/workers" hx-trigger="load, refresh-workers from:body" hx-target="this"></div>
			}
		</div>
	}
}

templ newWorker() {
	<details>
		<summary class="select-none">new worker</summary>
		<form class="flex flex-col p-2 gap-1" hx-post="/api/worker">
			<label>name</label>
			<input class="border" type="text" placeholder="..." name="name"/>
			<button class="border p-1" type="submit">add</button>
		</form>
	</details>
}