From 6657898c4d4b1a4f5e0ad5a20167f83cbfe35ff2 Mon Sep 17 00:00:00 2001 From: trevormunoz Date: Tue, 4 May 2021 20:44:28 -0400 Subject: [PATCH] Start work on exhibit template update refs #14 --- src/templates/exhibit.js | 58 +++++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 25 deletions(-) diff --git a/src/templates/exhibit.js b/src/templates/exhibit.js index 126be1664f3..ec3b0fa2c1f 100644 --- a/src/templates/exhibit.js +++ b/src/templates/exhibit.js @@ -1,44 +1,52 @@ -import React from 'react' -import Layout from '../components/layout' -import { Link, withPrefix } from 'gatsby' -import remark from 'remark' -import remarkHtml from 'remark-html' -import recommended from 'remark-preset-lint-recommended' +import React from "react" +import Layout from "../components/layout" +import { Link, withPrefix } from "gatsby" +import { GatsbyImage, getImage } from "gatsby-plugin-image" +import remark from "remark" +import remarkHtml from "remark-html" +import recommended from "remark-preset-lint-recommended" // import './exhibit.css' -const convertMarkdown = remark().use(recommended).use(remarkHtml).processSync +const convertMarkdown = remark() + .use(recommended) + .use(remarkHtml).processSync -const Visual = ({title, image}) => ( -
- {title} -
-
-) +const Visual = ({ title, image }) => { + const gimage = getImage(image) -const RelatedItem = ({title, url, description}) => { + return ( +
+ + {/* {title} */} +
+
+ ) +} + +const RelatedItem = ({ title, url, description }) => { // adjust the url so we can create an in-app link with Link // note: we remove the /airwaves prefix because Link adds it back on // when building with --prefix-paths const uri = new URL(url) let localPath = uri.pathname + uri.search + uri.hash - localPath = localPath.replace(/^\/airwaves/, '') + localPath = localPath.replace(/^\/airwaves/, "") return (

{title}

-
- {description} -
+
{description}
) } const Exhibit = ({ pageContext: exhibit }) => { - if (! exhibit.visuals) exhibit.visuals = [] + if (!exhibit.visuals) exhibit.visuals = [] return (
@@ -48,13 +56,12 @@ const Exhibit = ({ pageContext: exhibit }) => {
-
-
+
+
{exhibit.visuals.map(v => ( - + ))}
@@ -62,10 +69,11 @@ const Exhibit = ({ pageContext: exhibit }) => {

Related Items

{exhibit.related.map(r => ( - + url={r.url} + /> ))}