File size: 1,690 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
import { Block, Field } from "payload/types";
import { backgroundColor } from "../../fields/backgroundColor";
import link from "../../fields/link";
import richText from "../../fields/richText";
const columnFields: Field[] = [
richText(),
{
name: "enableLink",
type: "checkbox",
},
link({
overrides: {
admin: {
condition: (_, { enableLink }) => Boolean(enableLink),
},
},
}),
];
export const Content: Block = {
slug: "content",
fields: [
{
type: "row",
fields: [
backgroundColor({ overrides: { name: "contentBackgroundColor" } }),
{
name: "layout",
type: "select",
defaultValue: "oneColumn",
options: [
{
label: "One Column",
value: "oneColumn",
},
{
label: "Two Thirds + One Third",
value: "twoThirdsOneThird",
},
{
label: "Half + Half",
value: "halfAndHalf",
},
{
label: "Three Columns",
value: "threeColumns",
},
],
},
],
},
{
name: "columnOne",
type: "group",
fields: columnFields,
},
{
name: "columnTwo",
type: "group",
fields: columnFields,
admin: {
condition: (_, { layout }) =>
["twoThirdsOneThird", "halfAndHalf", "threeColumns"].includes(layout),
},
},
{
name: "columnThree",
type: "group",
fields: columnFields,
admin: {
condition: (_, { layout }) => layout === "threeColumns",
},
},
],
};
|