From 74428c3d779a5abe4c928e03f5ce0a390c8e0adf Mon Sep 17 00:00:00 2001 From: belle Date: Sun, 16 Jun 2024 18:37:40 -0400 Subject: [PATCH] shop css --- components/arcade/prizes.js | 2 +- components/arcade/shop-component.js | 82 +++++++++++++-------------- pages/arcade/[userAirtableID]/shop.js | 12 +++- 3 files changed, 51 insertions(+), 45 deletions(-) diff --git a/components/arcade/prizes.js b/components/arcade/prizes.js index 6a05be7c..2a103b66 100644 --- a/components/arcade/prizes.js +++ b/components/arcade/prizes.js @@ -38,7 +38,7 @@ const Prizes = ({ alignItems: 'center' }} > - + {text} diff --git a/components/arcade/shop-component.js b/components/arcade/shop-component.js index 0afce439..fef1ef0a 100644 --- a/components/arcade/shop-component.js +++ b/components/arcade/shop-component.js @@ -3,6 +3,8 @@ import { Image, Link, Text } from 'theme-ui' import { useRouter } from 'next/router' import { Box, Grid } from 'theme-ui' import Prizes from './prizes' +import { Balancer } from 'react-wrap-balancer' + /** @jsxImportSource theme-ui */ const styled = ` @@ -22,7 +24,11 @@ body { ` -export default function ShopComponent({ availableItems, userAirtableID = null, hoursBalance = null }) { +export default function ShopComponent({ + availableItems, + userAirtableID = null, + hoursBalance = null +}) { function buyLink(itemID, quantity = 1) { return `https://forms.hackclub.com/arcade-order?user_id=${userAirtableID}&item_id=${itemID}&quantity=${quantity}` } @@ -31,23 +37,21 @@ export default function ShopComponent({ availableItems, userAirtableID = null, h return ( <> -

+ - Shop -

- for {userAirtableID} - {hoursBalance !== null && ( - You currently have {hoursBalance} 🎟️ tickets! Click on item to buy! - )} - + + {/* {hoursBalance !== null && ( + + You currently have {hoursBalance} 🎟️ tickets! Click on item to buy! + + )} */} + - {availableItems.sort((a,b) => a['Cost Hours'] - b['Cost Hours']).map((item, i) => ( - 0.5 ? 1 : -1) - } - link={buyLink(item.id)} - key={part.id} - /> - - //
  • - // {includeBuyLink && ( - // Buy - // )} - //

    {item['Name']}

    - //

    {item['Description']}

    - //

    {item['Cost Hours']} 🎟️

    - //
  • - ))} + {availableItems + .sort((a, b) => a['Cost Hours'] - b['Cost Hours']) + .map((item, i) => ( + 0.5 ? 1 : -1) + } + link={buyLink(item.id)} + key={item.id} + /> + ))}
    + ) -} \ No newline at end of file +} diff --git a/pages/arcade/[userAirtableID]/shop.js b/pages/arcade/[userAirtableID]/shop.js index d418d7ac..36185d99 100644 --- a/pages/arcade/[userAirtableID]/shop.js +++ b/pages/arcade/[userAirtableID]/shop.js @@ -2,6 +2,7 @@ import ShopComponent from "../../../components/arcade/shop-component" import { getArcadeUser } from "../../api/arcade/[userAirtableID]" import { shopParts } from "../../api/arcade/shop" import { Image, Link, Text } from 'theme-ui' +import { Balancer } from "react-wrap-balancer" /** @jsxImportSource theme-ui */ const styled = ` @@ -25,18 +26,22 @@ export default function Shop({ availableItems, userAirtableID = null, hoursBalan return ( <> +

    Welcome to the shop

    +
    Your current balance is {Math.floor(hoursBalance)} 🎟️ @@ -61,7 +66,8 @@ export async function getStaticProps({params}) { 'Name': item['Name'] || null, 'Description': item['Description'] || null, 'Cost Hours': item['Cost Hours'] || 0, - id: item.id + id: item.id, + 'Image URL': item['Image URL'] || null })) props.availableItems = availableItems }),