/** @jsx jsx */ import { jsx } from "theme-ui" import * as React from "react" import type { HeadFC, PageProps } from "gatsby" import { IGatsbyImageData, GatsbyImage } from "gatsby-plugin-image" import Layout from "./layout" import GridItem from "./grid-item" import { itemListWrapperStyles, itemStyles } from "../styles/item-list" import locales from "../locales" import { visuallyHidden } from "../styles/utils" import modifyGrid from "../utils/modify-grid" import Seo from "./seo" export type JodieHomepageProps = { projects: { nodes: { slug: string title: string cover: { childImageSharp: { gatsbyImageData: IGatsbyImageData } } __typename: "MdxProject" }[] } pages: { nodes: { slug: string title: string cover: { childImageSharp: { gatsbyImageData: IGatsbyImageData } } __typename: "MdxPage" }[] } } const Homepage: React.FC> = ({ data: { pages, projects } }) => { const rawItems = [...pages.nodes, ...projects.nodes] const items = modifyGrid(rawItems) const itemsCount = items.length let divisor = 9 for (let i = 0; i < itemsCount; i++) { const quotient = itemsCount % divisor const quotientAlt = (itemsCount - 1) % divisor if (quotient === 0 || quotientAlt === 0) { break } divisor -= 1 } return (

{locales.home}

{items.length > 0 ? ( items.map((item, index) => ( {item.title} )) ) : (
No projects and pages found at the locations defined for "projectsPath" and "pagesPath"
)}
) } export default Homepage export const Head: HeadFC = () =>