Skip to content

Commit

Permalink
pages for collections
Browse files Browse the repository at this point in the history
  • Loading branch information
raffazizzi committed Oct 28, 2024
1 parent 19318dc commit 165a671
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 5 deletions.
61 changes: 61 additions & 0 deletions gatsby-node.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import type { Actions, CreatePagesArgs, GatsbyNode } from "gatsby";
import path from "path";

interface IMakePages {
createPage: Actions["createPage"]
graphql: CreatePagesArgs["graphql"]
}

export const createPages: GatsbyNode["createPages"] = async ({ actions: { createPage }, graphql }) => {

const utils: IMakePages = {createPage, graphql};

await makeCollectionPages(utils)
}

async function makeCollectionPages({createPage, graphql}: IMakePages) {
const results = await graphql(`
query qCollections {
allAirtableScdItems(
filter: {data: {scd_publish_status: {nin: ["duplicate-record-do-not-display", "do-not-display"]}}}
) {
nodes {
data {
_xxxid
scd_publish_status
_xxxcollectionOwnerNamextxt
_xxxcollectionTitlextxt
_xxxcollectionDescriptionxtxt
_xxxcollectionExtentxtxt
_xcollectionFormatsxtxtxxxcollectionFormatsxtxt
_xxxcollectionContentTypesxtxtxxxcollectionContentTypesxtxt
_xxxcollectionGenresxtxtxxxcollectionGenresxtxt
_xxxcollectionFindingAidUrlxtxt
_xxxcollectionOwnerLocationCountryxtxt
_xxxcollectionOwnerLocationStatextxt
_xxxcollectionCatalogUrlxtxt
_xxxcollectionInventoryDescriptionxtxtxxxcollectionInventoryDescriptionxtxt
_xxxcollectionLanguagesxtxtxxxcollectionLanguagesxtxt
_xxxcollectionNotesxtxt
_xxxcollectionOwnerLocationCityxtxt
_xxxcollectionUsageStatementxtxt
_xxxcollectionWebsiteUrlxtxt
}
}
}
}
`)

const {nodes} = (results.data as Queries.qCollectionsQuery).allAirtableScdItems;

for (const node of nodes) {
const collection = node.data
createPage({
path: `/collections/${collection?._xxxid}/`,
component: path.resolve(`./src/templates/collection.tsx`),
context: {
...collection
}
})
}
}
2 changes: 1 addition & 1 deletion src/components/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import logoArsc from "../images/arsc-logo.png"
import logoMith from "../images/MITHgrayscale.png"

const Footer = () => {
return (<footer className="absolute bottom-0 w-full min-h-20 pt-4 border-t-gray-300 bg-gray-100">
return (<footer className="w-full min-h-20 pt-4 border-t-gray-300 bg-gray-100">
<div className="w-full max-w-hlg items-center px-4 m-auto flex flex-wrap">
<a className="block align-middle max-w-20 relative p-4 w-full flex-[0_0_8%]" href="https://radiopreservation.org/"><img alt="RPTF logo" src={logoRptf} /></a>
<a className="block align-middle max-w-20 relative p-4 w-full flex-[0_0_8%]" href="http://arsc-audio.org/"><img alt="ARSC logo" src={logoArsc} /></a>
Expand Down
6 changes: 3 additions & 3 deletions src/components/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import Header from "./Header"
import Footer from "./Footer"

const Layout: React.FC<PropsWithChildren> = ({children}) => {
return (<>
return (<div>
<Header/>
<main>{children}</main>
<main style={{minHeight: "calc(100vh - 220px)"}}>{children}</main>
<Footer/>
</>)
</div>)
}

export default Layout
2 changes: 1 addition & 1 deletion src/styles/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
}
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
@apply text-base relative pb-32;
@apply text-base;
}
}

0 comments on commit 165a671

Please sign in to comment.