Create initial shopping page

This commit is contained in:
Max Wofford 2024-06-10 16:43:50 -04:00
parent 67425da714
commit 556b2a2fd5
2 changed files with 33 additions and 1 deletions

View file

@ -11,7 +11,7 @@ const flavorText = async () => {
return records
}
const inventoryParts = async () => {
export const inventoryParts = async () => {
const airtable = new AirtablePlus({
apiKey: process.env.AIRTABLE_API_KEY,
baseID: "app3ODCEuTL5iGjb3",

32
pages/arcade/shop.js Normal file
View file

@ -0,0 +1,32 @@
import { inventoryParts } from "../api/arcade/inventory"
const ShopPage = ({parts}) => {
return (
<div>
<h1>Shop</h1>
<ul>
{parts.map(part => (
<li key={part.id}>
<h2>{part.fields['Name']}</h2>
<p>{part.fields['Name Small Text']}</p>
<p>{part.fields['Hours']}</p>
<img src={part.fields['Image URL']} alt={part.fields['Name']} />
</li>
))}
</ul>
</div>
)
}
export default ShopPage
export async function getStaticProps() {
const allparts = await inventoryParts()
const parts = allparts.filter(part => part.fields['Enabled'])
return {
props: {
parts
}
}
}