Bootstrapped during the 2026-06-06 BlockNinja consolidation. Was previously an unversioned directory inside ~/src/blockninja-themes/cyberpunk. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
44 lines
1.3 KiB
Go
44 lines
1.3 KiB
Go
package main
|
|
|
|
import (
|
|
"bytes"
|
|
"context"
|
|
|
|
"git.dev.alexdunmow.com/block/core/blocks"
|
|
)
|
|
|
|
// NavbarTerminalMeta defines metadata for the cyberpunk:navbar_terminal block.
|
|
var NavbarTerminalMeta = blocks.BlockMeta{
|
|
Key: "navbar_terminal",
|
|
Title: "Terminal Navbar",
|
|
Description: "Mono-spaced navbar with $ command prefix and optional status dot",
|
|
Category: blocks.CategoryNavigation,
|
|
Source: "cyberpunk",
|
|
}
|
|
|
|
// NavbarTerminalData is the typed view of the navbar_terminal content map.
|
|
type NavbarTerminalData struct {
|
|
MenuName string
|
|
CommandPrefix string
|
|
StatusDot bool
|
|
}
|
|
|
|
// NavbarTerminalBlock renders the navbar_terminal block.
|
|
//
|
|
// Content shape:
|
|
// {menuName, commandPrefix, statusDot:"on"|"off"|bool}
|
|
//
|
|
// menuName is the slug of a CMS-managed menu; the actual <ul> items are
|
|
// resolved by the host menu lookup. This block emits the chrome wrapper plus a
|
|
// data-menu-name hook the host renderer reads at runtime.
|
|
func NavbarTerminalBlock(ctx context.Context, content map[string]any) string {
|
|
data := NavbarTerminalData{
|
|
MenuName: getStringWithDefault(content, "menuName", "main"),
|
|
CommandPrefix: getStringWithDefault(content, "commandPrefix", "~/"),
|
|
StatusDot: getBool(content, "statusDot", true),
|
|
}
|
|
var buf bytes.Buffer
|
|
_ = navbarTerminalComponent(data).Render(ctx, &buf)
|
|
return buf.String()
|
|
}
|