feat(core-shared): add cta block

This commit is contained in:
2026-05-04 20:36:30 +02:00
parent 2d838b2dcf
commit 6bd428214f
2 changed files with 26 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
import { describe, expect, it } from "vitest";
import { cta } from "./cta";
describe("cta block", () => {
it("has slug 'cta'", () => {
expect(cta.slug).toBe("cta");
});
it("requires title, buttonLabel, and href", () => {
const fieldNames = cta.fields.map((f) => ("name" in f ? f.name : null));
expect(fieldNames).toEqual(["title", "buttonLabel", "href"]);
cta.fields.forEach((f) => {
if ("required" in f) expect(f.required).toBe(true);
});
});
});

View File

@@ -0,0 +1,10 @@
import type { Block } from "payload";
export const cta: Block = {
slug: "cta",
fields: [
{ name: "title", type: "text", required: true },
{ name: "buttonLabel", type: "text", required: true },
{ name: "href", type: "text", required: true },
],
};