about summary refs log tree commit diff stats
path: root/internal/components/options.templ
blob: 726d328c5d1a2865897a7029d61cd30256b41ac5 (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
package components

import (
	"searchix/internal/index"
	"searchix/internal/nix"
)

templ Options(result *index.Result) {
	<table>
		<thead>
			<tr>
				<td scope="col">Title</td>
				<td scope="col">Description</td>
			</tr>
		</thead>
		<tbody>
			for _, hit := range result.Hits {
				@optionRow(hit.Data.(nix.Option))
			}
		</tbody>
	</table>
}

templ optionRow(o nix.Option) {
	<tr>
		<td>
			@openDialogLink(o.Name)
		</td>
		<td>
			@markdown(firstSentence(o.Description))
			<dialog id={ o.Name }></dialog>
		</td>
	</tr>
}