feat: add generic Call-to-Action section block#48
Merged
Conversation
Add a reusable Call-to-Action block (heading + description + a configurable list of link buttons) for the page section system, plus spotify, apple-podcasts and globe outline icons. Each link supports a label, URL, optional icon and button style; the Astro component reuses the existing buttonStyles helper for consistency. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013JwSAfFX2ENovr21t5TkeM
|
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
Reuse the shared isValidURL helper (URL-class based, http/https only) to validate the url field on each call-to-action link, matching the pattern already used on the Customers collection. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01622xFmFcFwejfHXk54uWvp
A custom validate replaces Payload's built-in text validation, so the `required: true` presence check no longer runs on its own. Handle the empty case explicitly (honoring the field's required option) so a missing URL reports "URL is required" instead of the misleading "Invalid URL". Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01622xFmFcFwejfHXk54uWvp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a generic Call-to-Action section block — a reusable "heading + text + link buttons" block for any promo that points the visitor somewhere (podcast, newsletter, external profiles, "book a call", …). Rather than hard-coding a single use case, it exposes a localized title/description and an array of links, each with its own label, URL, icon, and button style, so it can be reused across pages.
Changes
CMS (Payload)
cms/src/blocks/CallToActionBlock.ts— new block (slug: call-to-action) with localizedtitle,description, and a requiredlinksarray (label, url, per-linkiconandstyle).cms/src/collections/Pages.ts— register the block in the Pages blocks list.cms/src/payload-types.ts— regenerated types for the new block.Web (Astro)
web/src/components/blocks/CallToActionBlock.astro— frontend rendering (heading, description, and a list of styled link buttons with optional icons; links open in a new tab withrel="noopener noreferrer").web/src/components/SectionBlock.astro— wire up thecall-to-actioncase.web/src/components/icons/Icon.astro+ new icons (spotify.svg,apple-podcasts.svg,globe.svg) — support the new icon options.web/src/integrations/htmlToMarkdown.ts— handle the block in markdown output.Note
There is no separate "podcast block" — the podcast CTA use case is intended to be covered by this generic block via the per-link icons (Spotify / Apple Podcasts / globe) and button styles.
🤖 Generated with Claude Code
Generated by Claude Code