Bootstrapped during the 2026-06-06 BlockNinja consolidation. Was previously an unversioned directory inside ~/src/blockninja-themes/y2k. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
33 lines
713 B
Go
33 lines
713 B
Go
package main
|
|
|
|
import (
|
|
"bytes"
|
|
"context"
|
|
)
|
|
|
|
// Y2KImageBlock applies the chrome-bordered image frame to the built-in
|
|
// image block.
|
|
// Content: {url, alt, caption, class}
|
|
func Y2KImageBlock(ctx context.Context, content map[string]any) string {
|
|
data := Y2KImageData{
|
|
URL: getString(content, "url"),
|
|
Alt: getString(content, "alt"),
|
|
Caption: getString(content, "caption"),
|
|
Class: getString(content, "class"),
|
|
}
|
|
if data.URL == "" {
|
|
return ""
|
|
}
|
|
var buf bytes.Buffer
|
|
_ = y2kImageComponent(data).Render(ctx, &buf)
|
|
return buf.String()
|
|
}
|
|
|
|
// Y2KImageData is the typed shape for the templ component.
|
|
type Y2KImageData struct {
|
|
URL string
|
|
Alt string
|
|
Caption string
|
|
Class string
|
|
}
|