Remade the title block to be multi-purpose and added the facebook widget
This commit was merged in pull request #15.
This commit is contained in:
@@ -17,11 +17,6 @@ export const Content: PageBlockFunction<PageBlocksContent> = ({ data }) => {
|
||||
size="custom"
|
||||
width="large"
|
||||
>
|
||||
{ data.withTitle ?
|
||||
<div className={ "main-title" }
|
||||
data-tina-field={ tinaField(data, "title") }>
|
||||
{ data.title }
|
||||
</div> : null }
|
||||
<TinaMarkdown components={ inlineComponents } content={ data.body } />
|
||||
</Container>
|
||||
</Section>
|
||||
@@ -39,17 +34,6 @@ export const contentBlockSchema: Template = {
|
||||
},
|
||||
fields: [
|
||||
{
|
||||
type: "boolean",
|
||||
label: "With Title",
|
||||
name: "withTitle"
|
||||
},
|
||||
{
|
||||
type: "string",
|
||||
label: "Title",
|
||||
name: "title"
|
||||
},
|
||||
{
|
||||
|
||||
type: "rich-text",
|
||||
label: "Body",
|
||||
name: "body",
|
||||
|
||||
48
components/blocks/facebook-page-timeline.tsx
Normal file
48
components/blocks/facebook-page-timeline.tsx
Normal file
@@ -0,0 +1,48 @@
|
||||
import React from "react";
|
||||
import { Container } from "../util/container";
|
||||
import { Section } from "../util/section";
|
||||
import type { Template } from "tinacms";
|
||||
import { PageBlockFunction } from "../blocks-renderer";
|
||||
import { PageBlocksFacebookPageTimeline } from "../../tina/__generated__/types";
|
||||
|
||||
export const FacebookPageTimeline: PageBlockFunction<PageBlocksFacebookPageTimeline> = ({ data }) => {
|
||||
return (
|
||||
<Section>
|
||||
<Container
|
||||
className={ "mt-2 flex justify-center" }
|
||||
size="custom"
|
||||
width="large"
|
||||
>
|
||||
{ data.page &&
|
||||
<iframe
|
||||
src={ `https://www.facebook.com/plugins/page.php?href=${
|
||||
encodeURIComponent(data.page)
|
||||
}&tabs=timeline&width=500&height=500&small_header=false&adapt_container_width=true&hide_cover=false&show_facepile=true&appId` }
|
||||
width="500"
|
||||
height="500"
|
||||
style={ { border: "none", overflow: "hidden" } }
|
||||
scrolling="no"
|
||||
frameBorder="0"
|
||||
allowFullScreen={ true }
|
||||
allow="autoplay; clipboard-write; encrypted-media; picture-in-picture; web-share"/> }
|
||||
</Container>
|
||||
</Section>
|
||||
);
|
||||
};
|
||||
|
||||
export const facebookPageTimelineBlockSchema: Template = {
|
||||
name: "facebookPageTimeline",
|
||||
label: "Plugin page facebook",
|
||||
ui: {
|
||||
defaultItem: {
|
||||
page: ""
|
||||
}
|
||||
},
|
||||
fields: [
|
||||
{
|
||||
type: "string",
|
||||
label: "URL Page",
|
||||
name: "page"
|
||||
}
|
||||
]
|
||||
};
|
||||
@@ -2,20 +2,27 @@ import React from "react";
|
||||
import { Container } from "../util/container";
|
||||
import { Section } from "../util/section";
|
||||
import type { Template } from "tinacms";
|
||||
import { PageBlocksMainTitle } from "../../tina/__generated__/types";
|
||||
import { PageBlocksTitle } from "../../tina/__generated__/types";
|
||||
import { tinaField } from "tinacms/dist/react";
|
||||
import { PageBlockFunction } from "../blocks-renderer";
|
||||
|
||||
export const MainTitle: PageBlockFunction<PageBlocksMainTitle> = ({ data }) => {
|
||||
enum titleSize {
|
||||
h1 = "h1",
|
||||
h2 = "h2",
|
||||
h3 = "h3",
|
||||
h4 = "h4"
|
||||
}
|
||||
|
||||
export const Title: PageBlockFunction<PageBlocksTitle> = ({ data }) => {
|
||||
return (
|
||||
<Section>
|
||||
<Container
|
||||
className={ "prose default-text-color my-2 main-title" }
|
||||
className={ `prose default-text-color mt-2 title-block${ data?.size ? ` title-size-${ data.size }` : "" }` }
|
||||
|
||||
size="custom"
|
||||
width="large"
|
||||
>
|
||||
<div className={ "main-title" }
|
||||
<div className={ "title-block" }
|
||||
data-tina-field={ tinaField(data, "title") }>
|
||||
{ data.title }
|
||||
</div>
|
||||
@@ -24,19 +31,26 @@ export const MainTitle: PageBlockFunction<PageBlocksMainTitle> = ({ data }) => {
|
||||
);
|
||||
};
|
||||
|
||||
export const mainTitleBlockSchema: Template = {
|
||||
name: "mainTitle",
|
||||
label: "Main title",
|
||||
export const titleBlockSchema: Template = {
|
||||
name: "title",
|
||||
label: "Titre",
|
||||
ui: {
|
||||
previewSrc: "/blocks/content.png",
|
||||
defaultItem: {
|
||||
size: Object.values(titleSize)[0],
|
||||
title: "Lorem ipsum"
|
||||
}
|
||||
},
|
||||
fields: [
|
||||
{
|
||||
type: "string",
|
||||
label: "Title",
|
||||
label: "Taille",
|
||||
name: "size",
|
||||
options: Object.values(titleSize)
|
||||
},
|
||||
{
|
||||
type: "string",
|
||||
label: "Texte",
|
||||
name: "title"
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user