Add landing page for kjol, documentation
This commit is contained in:
@@ -230,12 +230,12 @@ const (
|
||||
FuzzyDisplayNone = "none" // render only the input (headless)
|
||||
)
|
||||
|
||||
const fuzzyInputCls = "bg-white block w-full border border-neutral-300 rounded-default shadow-xs text-sm p-2 h-[38px] focus:outline-2 focus:outline-offset-1 focus:outline-sky-500"
|
||||
const fuzzyInputCls = "bg-surface block w-full border border-line-strong rounded-default shadow-xs text-sm p-2 h-[38px] focus:outline-2 focus:outline-offset-1 focus:outline-sky-500"
|
||||
|
||||
// Mirror FormCombobox's dropdown styling: neutral hover / highlight.
|
||||
const fuzzyDropdownCls = "bg-white border border-neutral-300 rounded-default shadow-lg max-h-60 overflow-auto"
|
||||
const fuzzyDropdownOptionCls = "w-full text-left p-2 text-sm cursor-pointer flex items-center justify-between gap-2 bg-transparent border-none hover:bg-neutral-100 whitespace-nowrap"
|
||||
const fuzzyDropdownOptionHighlightCls = "bg-neutral-100"
|
||||
const fuzzyDropdownCls = "bg-surface border border-line-strong rounded-default shadow-lg max-h-60 overflow-auto"
|
||||
const fuzzyDropdownOptionCls = "w-full text-left p-2 text-sm cursor-pointer flex items-center justify-between gap-2 bg-transparent border-none hover:bg-surface-raised whitespace-nowrap"
|
||||
const fuzzyDropdownOptionHighlightCls = "bg-surface-raised"
|
||||
|
||||
// FuzzyMatchProps configures the FuzzyMatch component. Query / Open / Highlighted
|
||||
// are caller-held state (read at the call site); the On* callbacks report changes.
|
||||
@@ -262,7 +262,7 @@ func fuzzyHighlight(segments []FuzzySegment) []*vdom.VNode {
|
||||
out := make([]*vdom.VNode, 0, len(segments))
|
||||
for _, seg := range segments {
|
||||
if seg.Match {
|
||||
out = append(out, vdom.Span(vdom.Attr("class", "text-sky-700 font-semibold"), vdom.Text(seg.Text)))
|
||||
out = append(out, vdom.Span(vdom.Attr("class", "text-sky-700 dark:text-sky-400 font-semibold"), vdom.Text(seg.Text)))
|
||||
} else {
|
||||
out = append(out, vdom.Span(vdom.Text(seg.Text)))
|
||||
}
|
||||
@@ -275,7 +275,7 @@ func fuzzyScoreBadge(show bool, score int) *vdom.VNode {
|
||||
if !show {
|
||||
return nil
|
||||
}
|
||||
return vdom.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-ink-faint"), vdom.Text(strconv.Itoa(score)))
|
||||
}
|
||||
|
||||
// fuzzyListView renders the inline "list" display. Before the user types, all
|
||||
@@ -296,12 +296,12 @@ func fuzzyListView(p FuzzyMatchProps, results []FuzzyRankedItem) *vdom.VNode {
|
||||
for _, r := range items {
|
||||
r := r
|
||||
li := []vdom.Mod{
|
||||
vdom.Attr("class", "flex items-center justify-between gap-3 px-2 py-1 rounded-default cursor-pointer hover:bg-neutral-100"),
|
||||
vdom.Attr("class", "flex items-center justify-between gap-3 px-2 py-1 rounded-default cursor-pointer hover:bg-surface-raised"),
|
||||
}
|
||||
if p.OnSelect != nil {
|
||||
li = append(li, vdom.On(vdom.EVENT_CLICK, func() { p.OnSelect(r.Value, r) }))
|
||||
}
|
||||
li = append(li, vdom.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-ink")}, fuzzyHighlight(r.Segments))...))
|
||||
if badge := fuzzyScoreBadge(p.ShowScores, r.Score); badge != nil {
|
||||
li = append(li, badge)
|
||||
}
|
||||
@@ -309,7 +309,7 @@ func fuzzyListView(p FuzzyMatchProps, results []FuzzyRankedItem) *vdom.VNode {
|
||||
}
|
||||
outer = append(outer, vdom.Ul(ul...))
|
||||
} else if strings.TrimSpace(p.Query) != "" {
|
||||
outer = append(outer, vdom.P(vdom.Attr("class", "text-sm text-neutral-500 italic"),
|
||||
outer = append(outer, vdom.P(vdom.Attr("class", "text-sm text-ink-muted italic"),
|
||||
vdom.Text(`No matches for "`+p.Query+`".`)))
|
||||
}
|
||||
return vdom.Div(outer...)
|
||||
@@ -338,7 +338,7 @@ 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.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-ink")}, fuzzyHighlight(r.Segments))...))
|
||||
if badge := fuzzyScoreBadge(p.ShowScores, r.Score); badge != nil {
|
||||
btnMods = append(btnMods, badge)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user