import * as React from "react";
import { TinaMarkdown } from "tinacms/dist/rich-text";
import { linkTarget } from "../../helpers/utilities";
import { Section } from "../section";
import { buttonsSchema } from "../../schema/buttons"
import { backgroundSchema } from "../../schema/background"
import { contentSchema } from "../../schema/content"
import { imageSchema } from '../../schema/image';
import { navigationLabelSchema } from "../../schema/navigation-label";
export const TailwindFeature = ({ data, parentField = "" }) => {
const tw = data.tailwind || {};
const headlineElement = () => {
if (data?.headline && parentField === 'blocks.0') {
return (
<>
{data.headline}
{data.subhead && {data.subhead}
}
>
)
} else if (data?.headline) {
return (
<>
{data.headline}
{data.subhead && {data.subhead}
}
>
)
}
}
return (
{data.image?.src && (

)}
{data.label &&
{data.label}
}
{headlineElement()}
{data.body?.children && (
)}
{data.buttons && (
{data.buttons &&
data.buttons.map(function (button, index) {
const element = (
{ button.label }
);
return element;
})}
)}
);
};
export const tailwindFeatureBlockSchema: any = {
label: "Tailwind Feature",
name: "tailwindFeature",
ui: {
defaultItem: {
label: "",
headline: "This is the main headline",
subhead: "Here is a subhead",
body: {
children: [
{
type: "p",
children: [
{
text: "This is a rich text component you can add hyperlinks, etc."
}
]
}
]
},
tailwind: {
section: "",
wrap: "",
imageWrap: "",
image: "",
contentWrap: "",
content: "",
label: "",
headline: "",
subhead: "",
text: "",
buttons: ""
}
},
},
fields: [
{
type: "object",
label: "Tailwind",
name: "tailwind",
ui: {
component: "group",
},
fields: [
{
label: "Section",
name: "section",
type: "string",
},
{
label: "Wrap",
name: "wrap",
type: "string",
},
{
label: "Image Wrap",
name: "imageWrap",
type: "string",
},
{
label: "Image",
name: "image",
type: "string",
},
{
label: "Content Wrap",
name: "contentWrap",
type: "string",
},
{
label: "Content",
name: "content",
type: "string",
},
{
label: "Label",
name: "label",
type: "string",
},
{
label: "Headline",
name: "headline",
type: "string",
},
{
label: "Subhead",
name: "subhead",
type: "string",
},
{
label: "Text",
name: "text",
type: "string",
},
{
label: "Buttons",
name: "buttons",
type: "string",
},
{
label: "Button",
name: "button",
type: "string",
},
],
},
backgroundSchema,
imageSchema,
...contentSchema,
buttonsSchema,
navigationLabelSchema,
],
};