Add fonts, autotable, autotable examples
This commit is contained in:
@@ -262,9 +262,9 @@ func fuzzyHighlight(segments []FuzzySegment) []*vdom.VNode {
|
||||
out := make([]*vdom.VNode, 0, len(segments))
|
||||
for _, seg := range segments {
|
||||
if seg.Match {
|
||||
out = append(out, vdom.El("span", vdom.Attr("class", "text-sky-700 font-semibold"), vdom.Text(seg.Text)))
|
||||
out = append(out, vdom.Span(vdom.Attr("class", "text-sky-700 font-semibold"), vdom.Text(seg.Text)))
|
||||
} else {
|
||||
out = append(out, vdom.El("span", vdom.Text(seg.Text)))
|
||||
out = append(out, vdom.Span(vdom.Text(seg.Text)))
|
||||
}
|
||||
}
|
||||
return out
|
||||
@@ -275,7 +275,7 @@ func fuzzyScoreBadge(show bool, score int) *vdom.VNode {
|
||||
if !show {
|
||||
return nil
|
||||
}
|
||||
return vdom.El("span", vdom.Attr("class", "ml-3 shrink-0 text-xs text-neutral-400"), vdom.Text(strconv.Itoa(score)))
|
||||
return vdom.Span(vdom.Attr("class", "ml-3 shrink-0 text-xs text-neutral-400"), vdom.Text(strconv.Itoa(score)))
|
||||
}
|
||||
|
||||
// fuzzyListView renders the inline "list" display. Before the user types, all
|
||||
@@ -301,19 +301,18 @@ func fuzzyListView(p FuzzyMatchProps, results []FuzzyRankedItem) *vdom.VNode {
|
||||
if p.OnSelect != nil {
|
||||
li = append(li, vdom.On(vdom.EVENT_CLICK, func() { p.OnSelect(r.Value, r) }))
|
||||
}
|
||||
li = append(li, vdom.El("span", kids([]vdom.Mod{vdom.Attr("class", "text-sm text-neutral-800")}, fuzzyHighlight(r.Segments))...))
|
||||
li = append(li, vdom.Span(kids([]vdom.Mod{vdom.Attr("class", "text-sm text-neutral-800")}, fuzzyHighlight(r.Segments))...))
|
||||
if badge := fuzzyScoreBadge(p.ShowScores, r.Score); badge != nil {
|
||||
li = append(li, badge)
|
||||
}
|
||||
ul = append(ul, vdom.El("li", li...))
|
||||
ul = append(ul, vdom.Li(li...))
|
||||
}
|
||||
outer = append(outer, vdom.El("ul", ul...))
|
||||
outer = append(outer, vdom.Ul(ul...))
|
||||
} else if strings.TrimSpace(p.Query) != "" {
|
||||
outer = append(outer, vdom.El("p",
|
||||
vdom.Attr("class", "text-sm text-neutral-500 italic"),
|
||||
outer = append(outer, vdom.P(vdom.Attr("class", "text-sm text-neutral-500 italic"),
|
||||
vdom.Text(`No matches for "`+p.Query+`".`)))
|
||||
}
|
||||
return vdom.El("div", outer...)
|
||||
return vdom.Div(outer...)
|
||||
}
|
||||
|
||||
// fuzzyDropdownView renders the "dropdown" display's option panel.
|
||||
@@ -339,13 +338,13 @@ func fuzzyDropdownView(p FuzzyMatchProps, results []FuzzyRankedItem) *vdom.VNode
|
||||
if p.OnSelect != nil {
|
||||
btnMods = append(btnMods, vdom.On(vdom.EVENT_CLICK, func() { p.OnSelect(r.Value, r) }))
|
||||
}
|
||||
btnMods = append(btnMods, vdom.El("span", kids([]vdom.Mod{vdom.Attr("class", "text-neutral-800")}, fuzzyHighlight(r.Segments))...))
|
||||
btnMods = append(btnMods, vdom.Span(kids([]vdom.Mod{vdom.Attr("class", "text-neutral-800")}, fuzzyHighlight(r.Segments))...))
|
||||
if badge := fuzzyScoreBadge(p.ShowScores, r.Score); badge != nil {
|
||||
btnMods = append(btnMods, badge)
|
||||
}
|
||||
mods = append(mods, vdom.El("button", btnMods...))
|
||||
mods = append(mods, vdom.Button(btnMods...))
|
||||
}
|
||||
return vdom.El("div", mods...)
|
||||
return vdom.Div(mods...)
|
||||
}
|
||||
|
||||
// FuzzyMatch renders a fuzzy-search input with inline ("list"), autocomplete
|
||||
@@ -377,7 +376,7 @@ func FuzzyMatch(p FuzzyMatchProps) *vdom.VNode {
|
||||
|
||||
mods := []vdom.Mod{
|
||||
vdom.Attr("class", cx("relative", p.Class)),
|
||||
vdom.El("input", inputMods...),
|
||||
vdom.Input(inputMods...),
|
||||
}
|
||||
|
||||
switch display {
|
||||
@@ -388,5 +387,5 @@ func FuzzyMatch(p FuzzyMatchProps) *vdom.VNode {
|
||||
mods = append(mods, fuzzyDropdownView(p, results))
|
||||
}
|
||||
}
|
||||
return vdom.El("div", mods...)
|
||||
return vdom.Div(mods...)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user