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>
50 lines
1.2 KiB
Go
50 lines
1.2 KiB
Go
package main
|
|
|
|
import (
|
|
"bytes"
|
|
"context"
|
|
|
|
"git.dev.alexdunmow.com/block/core/blocks"
|
|
)
|
|
|
|
// NFTGalleryBlockMeta declares the holographic-foil NFT gallery block.
|
|
// Presentational only - no signing UX in v0.1 per spec open question.
|
|
var NFTGalleryBlockMeta = blocks.BlockMeta{
|
|
Key: "nft_gallery",
|
|
Title: "NFT Gallery",
|
|
Description: "Holographic-foil hover gallery for NFT items (presentational only).",
|
|
Source: "y2k",
|
|
Category: blocks.CategoryContent,
|
|
}
|
|
|
|
// NFTGalleryBlock renders the gallery.
|
|
// Content: {items[{title, image, chain, href}]}
|
|
func NFTGalleryBlock(ctx context.Context, content map[string]any) string {
|
|
raw := getSlice(content, "items")
|
|
items := make([]NFTItem, 0, len(raw))
|
|
for _, r := range raw {
|
|
items = append(items, NFTItem{
|
|
Title: getString(r, "title"),
|
|
Image: getString(r, "image"),
|
|
Chain: getString(r, "chain"),
|
|
Href: getString(r, "href"),
|
|
})
|
|
}
|
|
var buf bytes.Buffer
|
|
_ = nftGalleryComponent(NFTGalleryData{Items: items}).Render(ctx, &buf)
|
|
return buf.String()
|
|
}
|
|
|
|
// NFTGalleryData is the typed shape for the templ component.
|
|
type NFTGalleryData struct {
|
|
Items []NFTItem
|
|
}
|
|
|
|
// NFTItem is a single gallery card.
|
|
type NFTItem struct {
|
|
Title string
|
|
Image string
|
|
Chain string
|
|
Href string
|
|
}
|