package main import ( "bytes" "context" "git.dev.alexdunmow.com/block/core/blocks" ) // MarqueeBlockMeta declares the marquee ticker block. var MarqueeBlockMeta = blocks.BlockMeta{ Key: "marquee", Title: "Marquee Ticker", Description: "Scrolling text marquee with chrome edges; pauses on hover.", Source: "y2k", Category: blocks.CategoryLayout, } // MarqueeBlock renders the marquee. // Content: {items[], speed, direction} func MarqueeBlock(ctx context.Context, content map[string]any) string { data := MarqueeData{ Items: getStringSlice(content, "items"), Speed: getStringOr(content, "speed", "medium"), Direction: getStringOr(content, "direction", "left"), } if len(data.Items) == 0 { data.Items = []string{"now playing", "new drop friday", "subscribe to the zine"} } var buf bytes.Buffer _ = marqueeComponent(data).Render(ctx, &buf) return buf.String() } // MarqueeData is the typed shape for the templ component. type MarqueeData struct { Items []string Speed string Direction string }