Newer
Older
import { graphql, PageProps } from "gatsby"
import { Layout, Content, Sections } from "@onegeo/gatsby-theme-onegeo"
directus: {
pages: {
id: string
title: string
content: string
slug: string
sections: ISection[] | []
}
}
const PageTemplate = ({ data }: PageProps<IPageContext>) => {
const news = data.directus.pages[0]
const { title, content, sections } = news
const idsSections = sections.map((section: any) => section.sections_id.id)
<Layout>
<Content>
{title && <h1 className="text-3xl font-extrabold">{title}</h1>}
{content && (
<div
className="text-lg leading-8 py-4 text-justify"
dangerouslySetInnerHTML={{ __html: content }}
></div>
)}
{Object.keys(idsSections).length !== 0 && (
<Sections ids={idsSections} />
)}
</Content>
</Layout>