Begin go documentation (ai slop for now)
This commit is contained in:
@@ -78,7 +78,11 @@ func wordmark(d Deps, href string) *VNode {
|
||||
}
|
||||
|
||||
return A(Attr("class", "flex items-center gap-2.5 no-underline"), Attr("href", href), navigate(d, href),
|
||||
Span(Attr("class", "inline-flex h-8 w-8 items-center justify-center rounded-default bg-ink text-surface"),
|
||||
// text-white, not text-surface: the flag is the same in both themes, so the boat on
|
||||
// top of it has to be too. text-surface inverts to near-black in dark mode, which
|
||||
// would hide the boat against the navy cross. The flag itself carries a dark scrim
|
||||
// (see .flag-no) so this plain white boat reads without a shadow of its own.
|
||||
Span(Attr("class", "inline-flex h-8 w-8 items-center justify-center rounded-default flag-no text-white"),
|
||||
ui.IconInline("sailboat", 17, "")),
|
||||
Span(Attr("class", "flex items-baseline gap-1.5"),
|
||||
Span(Attr("class", "text-lg font-semibold tracking-tight text-text-heading"), Text(name)),
|
||||
@@ -202,10 +206,14 @@ func AppLayout(d Deps, content *VNode) *VNode {
|
||||
// documents the C base layer. A sidebar listing the engine's chapters while you are
|
||||
// reading about arenas would be worse than no sidebar at all.
|
||||
func sidebarNav(path string) []docsGroup {
|
||||
if path == "/c" || strings.HasPrefix(path, "/c/") {
|
||||
switch {
|
||||
case path == "/c" || strings.HasPrefix(path, "/c/"):
|
||||
return cNav()
|
||||
case path == "/go" || strings.HasPrefix(path, "/go/"):
|
||||
return goNav()
|
||||
default:
|
||||
return docsNav()
|
||||
}
|
||||
return docsNav()
|
||||
}
|
||||
|
||||
func docsSidebar(d Deps) *VNode {
|
||||
@@ -225,11 +233,13 @@ func docsSidebar(d Deps) *VNode {
|
||||
return El("aside", mods...)
|
||||
}
|
||||
|
||||
// No icon: the sidebar is a list of words, and a glyph on every row is noise the reader has
|
||||
// to look past to read the label. The label is the navigation. (docsItem still carries an
|
||||
// Icon — it is used on the /docs index cards, where a larger tile earns one.)
|
||||
func sidebarLink(d Deps, it docsItem) *VNode {
|
||||
base, frag, isAnchor := strings.Cut(it.Path, "#")
|
||||
|
||||
cls := "flex items-center gap-2 rounded-default px-2 py-1.5 text-sm no-underline text-ink-soft hover:bg-surface-raised hover:text-ink"
|
||||
iconCls := "text-ink-faint"
|
||||
cls := "block rounded-default px-2 py-1.5 text-sm no-underline text-ink-soft hover:bg-surface-raised hover:text-ink"
|
||||
|
||||
// A section link is NEVER "active", and that is deliberate. It cannot be: it would
|
||||
// have to know which section you had scrolled to, which means measuring all fifteen of
|
||||
@@ -240,8 +250,7 @@ func sidebarLink(d Deps, it docsItem) *VNode {
|
||||
// than no highlight: it tells you nothing and looks broken.)
|
||||
active := !isAnchor && d.Path() == it.Path
|
||||
if active {
|
||||
cls = "active flex items-center gap-2 rounded-default px-2 py-1.5 text-sm no-underline bg-primary-subtle font-medium text-accent"
|
||||
iconCls = "text-accent"
|
||||
cls = "active block rounded-default px-2 py-1.5 text-sm no-underline bg-primary-subtle font-medium text-accent"
|
||||
}
|
||||
|
||||
click := navigate(d, it.Path)
|
||||
@@ -250,7 +259,6 @@ func sidebarLink(d Deps, it docsItem) *VNode {
|
||||
}
|
||||
|
||||
return A(Attr("class", cls), Attr("href", it.Path), click,
|
||||
ui.IconInline(it.Icon, 14, iconCls),
|
||||
Text(it.Label),
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user