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>
42 lines
1.1 KiB
Go
42 lines
1.1 KiB
Go
package main
|
|
|
|
import (
|
|
"bytes"
|
|
"context"
|
|
|
|
"git.dev.alexdunmow.com/block/core/blocks"
|
|
)
|
|
|
|
// CTATerminalMeta defines metadata for the cyberpunk:cta_terminal block.
|
|
var CTATerminalMeta = blocks.BlockMeta{
|
|
Key: "cta_terminal",
|
|
Title: "Terminal CTA",
|
|
Description: "Faux $ prompt with blinking caret and copy button",
|
|
Category: blocks.CategoryLayout,
|
|
Source: "cyberpunk",
|
|
}
|
|
|
|
// CTATerminalData is the typed view of the cta_terminal content map.
|
|
type CTATerminalData struct {
|
|
Prompt string
|
|
Button string
|
|
Href string
|
|
Copyable bool
|
|
}
|
|
|
|
// CTATerminalBlock renders the cta_terminal block.
|
|
//
|
|
// Content shape:
|
|
// {prompt, button, href, copyable: bool|"true"|"false"}
|
|
func CTATerminalBlock(ctx context.Context, content map[string]any) string {
|
|
data := CTATerminalData{
|
|
Prompt: getStringWithDefault(content, "prompt", "$ npm i your-thing"),
|
|
Button: getStringWithDefault(content, "button", "Copy"),
|
|
Href: getString(content, "href"),
|
|
Copyable: getBool(content, "copyable", true),
|
|
}
|
|
var buf bytes.Buffer
|
|
_ = ctaTerminalComponent(data).Render(ctx, &buf)
|
|
return buf.String()
|
|
}
|