themes-pastel-dream/soft_navbar.go
Alex Dunmow de55bbebd6 initial: theme plugin pastel-dream
Bootstrapped during the 2026-06-06 BlockNinja consolidation. Was previously
an unversioned directory inside ~/src/blockninja-themes/pastel-dream.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-06 14:11:41 +08:00

41 lines
1.1 KiB
Go

package main
import (
"bytes"
"context"
"git.dev.alexdunmow.com/block/core/blocks"
)
// SoftNavbarMeta defines metadata for the rounded pill navbar.
var SoftNavbarMeta = blocks.BlockMeta{
Key: "soft-navbar",
Title: "Soft Navbar",
Description: "Rounded pill navigation with a watercolor blob behind the logo.",
Source: "pastel-dream",
Category: blocks.CategoryNavigation,
}
// SoftNavbarBlock renders the navbar.
// Content shape: {logo: string, menuName: string, ctaText: string, ctaHref: string}
func SoftNavbarBlock(ctx context.Context, content map[string]any) string {
data := SoftNavbarData{
Logo: getStringOr(content, "logo", "Pastel Dream"),
MenuName: getString(content, "menuName"),
CTAText: getString(content, "ctaText"),
CTAHref: safeLink(getString(content, "ctaHref")),
}
var buf bytes.Buffer
_ = softNavbarComponent(data).Render(ctx, &buf)
return buf.String()
}
// SoftNavbarData is the rendered view of the navbar block.
type SoftNavbarData struct {
Logo string
MenuName string
CTAText string
CTAHref string
}