about summary refs log tree commit diff stats
path: root/internal/components/dev.go
blob: 3d77094d7755c568e5bf43a6545c6b951dac6cf4 (plain)
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

import (
	"strconv"

	"go.alanpearce.eu/searchix/internal/index"

	g "go.alanpearce.eu/gomponents"
	. "go.alanpearce.eu/gomponents/html"
)

func Score(h index.DocumentMatch) g.Node {
	return g.Group([]g.Node{
		A(
			Class("open-sibling-dialog"),
			g.Text(strconv.FormatFloat(h.Score, 'f', 2, 64)),
		),
		Dialog(
			Button(AutoFocus(), g.Text("Close")),
			Pre(g.Text(h.Expl.String())),
		),
	})
}