You need to sign in or sign up before continuing.
Newer
Older
import React from "react"
import { useStaticQuery, graphql } from "gatsby"
import { twMerge } from "tailwind-merge"
import { Content, Button } from "@onegeo-suite/gatsby-theme-onegeo"
import Component from "./section/component"
interface ISection {
id: string
}
directus {
sections {
id
title
subtitle
content
}
components {
components_id {
id
title
subtitle
content
url_dataviz
url_map
type
mapdid
layout
length
size
}
services {
services_id {
name
url
description
id
image {
imageFile {
publicURL
}
images {
directus_files_id {
imageFile {
childImageSharp {
gatsbyImageData
}
name
publicURL
const sectionColumns = {
1: "lg:grid-cols-1",
2: "lg:grid-cols-2",
3: "lg:grid-cols-3",
}
const sectionSize = {
full: "max-w-full",
xl: "max-w-7xl",
lg: "max-w-4xl",
const Section = (props: ISection) => {
const { id } = props
const section = data.directus.sections.find((section) => section.id === id)
if (!section) return null
const options = section.options ?? {}
const oClass = options.class || {}
// Need style for custom color / classname at runtime
const ContentStyle = section.background
? { backgroundColor: section.background }
: undefined
className={twMerge("mb-10", sectionSize[section.size], oClass.main)}
<h2
className={twMerge("text-3xl font-extrabold", oClass.title)}
>
{section.title}
</h2>
<h4
className={twMerge(
"mt-2 text-2xl font-bold",
oClass.subtitle
)}
>
{section.subtitle}
</h4>
className={twMerge(
"py-4 text-justify text-lg leading-8",
oClass.content
)}
className={twMerge(
"grid grid-cols-1 gap-4",
sectionColumns[section.components.length],
oClass.components
)}
return (
<React.Fragment key={dtComponent.id}>
<Component {...dtComponent} />
</React.Fragment>
)
})}
</div>
)}
<div className="mt-4 flex space-x-4">