all repos — searchix @ 4fa3ceb5ac040a84f2da405c46e4af1231d22f17

Search engine for NixOS, nix-darwin, home-manager and NUR users

feat: improve handling of long option descriptions

Alan Pearce
commit

4fa3ceb5ac040a84f2da405c46e4af1231d22f17

parent

1c56ff7fc392f2d7992e53add5bd76bc8855d4a6

M frontend/static/style.cssfrontend/static/style.css
@@ -162,13 +162,39 @@ margin-top: 0.5rem;
} table { - width: 100%; margin-top: 0; + width: 100%; + table-layout: fixed; + white-space: nowrap; +} + +th.description { + width: 50%; +} + +th.score { + width: 8ex; } td, th { padding: 0.25rem 0.5rem; + text-overflow: ellipsis; + overflow: clip; +} + +tr { + height: 1.5rem; +} + +td.description > * { + max-width: 100%; + text-overflow: ellipsis; + overflow: clip; +} + +td.description > *:not(:first-child) { + display: none; } ul:only-child {
M internal/components/combined.gointernal/components/combined.go
@@ -31,7 +31,7 @@ Tr(
Th(Scope("col"), g.Text("Attribute")), Th(Scope("col"), g.Text("Description")), g.If(config.DevMode, - Th(Scope("col"), g.Text("Score")), + Th(Scope("col"), Class("score"), g.Text("Score")), ), ), ),
@@ -41,7 +41,7 @@ return Tr(
Td( openCombinedDialogLink(nix.GetKey(hit.Data)), ), - Td( + Td(Class("description"), CombinedData(hit.Data), ), g.If(config.DevMode,
M internal/components/markdown.gointernal/components/markdown.go
@@ -4,7 +4,7 @@ import (
"regexp" ) -var firstSentenceRegexp = regexp.MustCompile(`^.*?\.[[:space:]]`) +var firstSentenceRegexp = regexp.MustCompile(`^.+?(\.[[:space:]]|:\n)`) func firstSentence[T ~string](text T) T { if fs := firstSentenceRegexp.FindString(string(text)); fs != "" {
M internal/components/options.gointernal/components/options.go
@@ -14,9 +14,9 @@ return Table(
THead( Tr( Th(Scope("col"), g.Text("Title")), - Th(Scope("col"), g.Text("Description")), + Th(Scope("col"), Class("description"), g.Text("Description")), g.If(config.DevMode, - Th(Scope("col"), g.Text("Score")), + Th(Scope("col"), Class("score"), g.Text("Score")), ), ), ),
@@ -37,7 +37,7 @@ return Tr(
Td( openDialogLink(o.Name), ), - Td( + Td(Class("description"), firstSentence(o.Description), Dialog(ID(o.Name)), ),
M internal/components/packages.gointernal/components/packages.go
@@ -15,9 +15,9 @@ THead(
Tr( Th(Scope("col"), g.Text("Attribute")), Th(Scope("col"), g.Text("Name")), - Th(Scope("col"), g.Text("Description")), + Th(Scope("col"), Class("description"), g.Text("Description")), g.If(config.DevMode, - Th(Scope("col"), g.Text("Score")), + Th(Scope("col"), Class("score"), g.Text("Score")), ), ), ),
@@ -41,7 +41,7 @@ ),
Td( g.Text(p.Name), ), - Td( + Td(Class("description"), g.Text(p.Description), ), g.If(config.DevMode,