package main import ( "bytes" "context" "git.dev.alexdunmow.com/block/core/blocks" ) // AffirmationMeta defines the affirmation strip block. var AffirmationMeta = blocks.BlockMeta{ Key: "affirmation", Title: "Affirmation Strip", Description: "Slow-shimmer band carrying a short calming line in display type.", Source: "pastel-dream", Category: blocks.CategoryTheme, } // AffirmationBlock renders the affirmation strip. // Content shape: {quote, author, palette} func AffirmationBlock(ctx context.Context, content map[string]any) string { palette := getStringOr(content, "palette", "blush") switch palette { case "blush", "mint", "butter", "sky": // valid default: palette = "blush" } data := AffirmationData{ Quote: getStringOr(content, "quote", "You are doing enough."), Author: getString(content, "author"), Palette: palette, } var buf bytes.Buffer _ = affirmationComponent(data).Render(ctx, &buf) return buf.String() } // AffirmationData is the rendered view of the affirmation block. type AffirmationData struct { Quote string Author string Palette string }