From 1700ebb9f3c60f7d1387ce5598e5e0fe0687dcf2 Mon Sep 17 00:00:00 2001 From: eloisetaylor5693 Date: Sun, 10 Dec 2023 22:28:52 +0000 Subject: [PATCH] Use the new resources contentful object to build up /resources page Will need to change icon based on the file type: https://stackoverflow.com/questions/13354578/custom-li-list-style-with-font-awesome-icon Also might be worth using the description in a tooltip --- src/pages/resources.js | 42 +++++++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/src/pages/resources.js b/src/pages/resources.js index 4a48172d..f2e74259 100644 --- a/src/pages/resources.js +++ b/src/pages/resources.js @@ -5,24 +5,30 @@ import Seo from "../components/seo"; import * as style from "./resources.module.css"; const ResourcesIndex = ({ data, location }) => { + console.log("data", data); + const siteTitle = data.site.siteMetadata?.title || `Title`; + const resourcesPageData = data.allContentfulResourcesPage?.nodes[0]; + return ( -

Resources

+

{resourcesPageData.title}

-

- Surveys, management plan, membership application form and other - interesting documents. -

+

{resourcesPageData.subTitle}

+ {/* https://stackoverflow.com/questions/13354578/custom-li-list-style-with-font-awesome-icon */} + {/* */} + {/* */} + {/* */} + {/* */}
    - {data.allContentfulAsset.nodes.map(node => { + {resourcesPageData.resourceFiles.map(resourceFile => { return (
  • - - {node.title} + + {resourceFile.title}
  • ); @@ -35,23 +41,25 @@ const ResourcesIndex = ({ data, location }) => { export default ResourcesIndex; export const pageQuery = graphql` - query { + query ResourcesPageQuery { site { siteMetadata { title } } - - allContentfulAsset( - filter: { file: { contentType: { eq: "application/pdf" } } } - ) { + allContentfulResourcesPage { nodes { - description title - file { - contentType + subTitle + id + resourceFiles { + file { + contentType + fileName + } + description + title url - fileName } } }