import * as React from "react"; import styled from "@emotion/styled"; import BaseLayout from "../components/BaseLayout"; import { Avatar } from "../components/Avatar"; import { SocialLinks } from "../components/SocialLinks"; import { PageRendererProps, graphql } from "gatsby"; import { useLocalJsonForm } from "gatsby-tinacms-json"; import { useLocalRemarkForm } from "gatsby-tinacms-remark"; import { SimpleRemarkSection, KeplerSimpleRemarkSection, } from "../components/SimpleRemarkSection"; import { FrontmatterDateRange, KeplerFrontmatterDateRange, } from "../components/DateRange"; // This is approximately the horizontal pixel measurement where the page begins to feel crampt, // and more vainly and subjectively when the hyphen in my last name wraps to a second line :D const MobileBreakPoint = "839px"; const AboutContainer = styled.div` display: flex; flex-direction: row; flex-wrap: nowrap; justify-content: center; padding: 1em; @media (max-width: ${MobileBreakPoint}) { flex-direction: column; } `; const ProfileContainer = styled.header` margin: 1em; display: flex; flex-direction: column; align-items: center; min-width: 33vw; @media (max-width: ${MobileBreakPoint}) { min-width: inherit; } `; const ExperienceContainer = styled.main` margin: 1em; flex-grow: 1; display: flex; flex-direction: column; `; const Name = styled.span` font-size: 2em; `; const Location = styled.span` font-size: 1em; `; const Detail = styled.span` :not(:last-of-type) { ::after { content: " ยท "; } } `; interface ExperienceProps { // remarkNode: { // frontmatter: { // position: string; // organization: string; // startDate: string; // startDateISO: string; // endDate?: string; // endDateISO?: string; // }; // html: string; // }; remarkNode: object; } const Experience = ({ remarkNode, }: ExperienceProps): React.ReactElement => { const [data] = useLocalRemarkForm(remarkNode); return (
{data!.frontmatter.position ? ( <>

{data!.frontmatter.position}

{data!.frontmatter.title} ) : (

{data!.frontmatter.title}

)}
); }; interface EducationProps { remarkNode: object; } const Education = ({ remarkNode, }: EducationProps): React.ReactElement => { const [data] = useLocalRemarkForm(remarkNode); return (

{data!.frontmatter.title}

{data!.frontmatter.degree && {data!.frontmatter.degree}}
); }; interface PageProps extends PageRendererProps { data: AboutPageQuery; } const AboutPage = (properties: PageProps): React.ReactElement => { const [info] = useLocalJsonForm(properties.data.info, { label: "Information", fields: [ { name: "rawJson.name", label: "Name", component: "text", description: "Name of the person featured on this page.", }, { name: "rawJson.location", label: "Location", component: "text", description: "Geographic location of the person featured on this page.", }, ], }); return ( {info?.name} {info?.location}

Experience

{properties.data.experience.edges.map(({ node }) => ( ))}

Education

{properties.data.education.edges.map(({ node }) => ( ))}
); }; export default AboutPage; interface AboutPageQuery { info: { name: string; location: string; // Needed for TinaCMS id: string; rawJson: string; fileRelativePath: string; }; biography: KeplerSimpleRemarkSection; experience: { edges: { node: { id: string; childMarkdownRemark: { html: string; frontmatter: { title: string; position?: string; } & KeplerFrontmatterDateRange; }; }; }[]; }; education: { edges: { node: { id: string; childMarkdownRemark: { html: string; frontmatter: { title: string; degree?: string; } & KeplerFrontmatterDateRange; }; }; }[]; }; skills: KeplerSimpleRemarkSection; } export const query = graphql` query KeplerAboutPageQuery { info: aboutJson { name location # Needed for TinaCMS id rawJson fileRelativePath } biography: file( sourceInstanceName: { eq: "about" } relativePath: { eq: "biography.md" } ) { ...KeplerSimpleRemarkSection } experience: allFile( filter: { sourceInstanceName: { eq: "experience" } } sort: { order: DESC, fields: relativePath } ) { edges { node { id childMarkdownRemark { html frontmatter { title position ...KeplerFrontmatterDateRange } ...TinaRemark } } } } education: allFile( filter: { sourceInstanceName: { eq: "education" } } sort: { order: DESC, fields: relativePath } ) { edges { node { id childMarkdownRemark { html frontmatter { title degree ...KeplerFrontmatterDateRange } ...TinaRemark } } } } skills: file( sourceInstanceName: { eq: "about" } relativePath: { eq: "skills.md" } ) { ...KeplerSimpleRemarkSection } } `;