diff --git a/components/arcade/showcase/cohort-card.js b/components/arcade/showcase/cohort-card.js index 41aef356..a9f3f750 100644 --- a/components/arcade/showcase/cohort-card.js +++ b/components/arcade/showcase/cohort-card.js @@ -3,22 +3,22 @@ import { Box, Card, Heading, Link, Text } from 'theme-ui' import styles from './cohort-card.module.css' -const CohortCard = ({ id, title, desc, slack, scrapbook, playable, images, githubProf, draggable = false}) => { +const CohortCard = ({ id, title, desc, slack, scrapbook, playable, images, githubProf, draggable = false }) => { console.log(images) return ( <> - -
- Project Image + +
+ Project Image

{title}

{desc}

- -
-
+ +
+ - - + + ) } diff --git a/components/arcade/showcase/cohort-card.module.css b/components/arcade/showcase/cohort-card.module.css index 41b6c04d..1c9b1a77 100644 --- a/components/arcade/showcase/cohort-card.module.css +++ b/components/arcade/showcase/cohort-card.module.css @@ -1,4 +1,4 @@ -.card{ +.card { flex: 1; break-inside: avoid; position: relative; @@ -13,7 +13,7 @@ } -.card_img{ +.card_img { width: 100%; height: auto; max-height: 100%; @@ -23,14 +23,15 @@ } -.card_title{ +.card_title { + color: #333; font-size: 1.5rem; font-weight: bold; margin-bottom: 0; } -.card_description{ +.card_description { font-size: 1rem; color: #333; margin: 0; @@ -41,9 +42,10 @@ overflow: hidden; text-overflow: ellipsis; max-height: 3em; + margin-bottom: 10px; } -.linkWrapper{ +.linkWrapper { display: block; text-decoration: none; color: inherit; diff --git a/components/arcade/showcase/create-card.js b/components/arcade/showcase/create-card.js new file mode 100644 index 00000000..7f0581eb --- /dev/null +++ b/components/arcade/showcase/create-card.js @@ -0,0 +1,18 @@ +import React from 'react' +import styles from './create-card.module.css' +import img from '../../../public/arcade/plus.png' + +const CreateCard = ({ createCardLink }) => { + return ( + <> + +
+ + Create a card +
+
+ + ) +} + +export default CreateCard \ No newline at end of file diff --git a/components/arcade/showcase/create-card.module.css b/components/arcade/showcase/create-card.module.css new file mode 100644 index 00000000..7952dc41 --- /dev/null +++ b/components/arcade/showcase/create-card.module.css @@ -0,0 +1,14 @@ +.card{ + flex: 1; + break-inside: avoid; + position: relative; + background-size: cover; + background-position: center; + overflow: hidden; + min-width: 100px; + display: flex; + flex-direction: column; + align-items: left; + justify-content: flex-start; + +} \ No newline at end of file diff --git a/pages/api/arcade/showcase/projects/[ID].js b/pages/api/arcade/showcase/projects/[ID].js new file mode 100644 index 00000000..1a7faec4 --- /dev/null +++ b/pages/api/arcade/showcase/projects/[ID].js @@ -0,0 +1,33 @@ +import AirtablePlus from "airtable-plus"; +import { ensureAuthed } from "../login/test"; + +export default async function handler(req, res) { + const { ID } = req.query + const user = await ensureAuthed(req) + if (user.error) { + return res.status(401).json(user) + } + + const airtable = new AirtablePlus({ + apiKey: process.env.AIRTABLE_API_KEY, + baseID: 'app4kCWulfB02bV8Q', + tableName: "Showcase" + }) + + const projects = await airtable.read({ + filterByFormula: `AND({User} = '${user.fields['Name']}', {ID} = '${ID}')` +}) + + const results = projects.map(p => ({ + id: p.id, + title: p.fields['Name'] || '', + desc: p.fields['Description'] || '', + slackLink: p.fields['Slack Link'] || '', + codeLink: p.fields['Code Link'] || '', + slackLink: p.fields['Slack Link'] || '', + playLink: p.fields['Play Link'] || '', + images: p.fields['Screenshot'].map(i => i.url) || [], + githubProf: p.fields['Github Profile'] || '' + })) + return res.status(200).json({ projects: results }) +} \ No newline at end of file diff --git a/pages/arcade/showcase/my.js b/pages/arcade/showcase/my.js index b7deb43e..b06b788a 100644 --- a/pages/arcade/showcase/my.js +++ b/pages/arcade/showcase/my.js @@ -8,12 +8,13 @@ import background from '../../../public/arcade/subtle-stripes.svg' import { Button, Heading, Text } from 'theme-ui' import SlideDown from '../../../components/slide-down' import styles from '../../../components/arcade/showcase/my.module.css' +import NewCard from '../../../components/arcade/showcase/create-card' const ProjectGallery = ({ projects }) => { - console.log('projects', projects) + console.log("projects", projects); return ( -
+
{projects.map(project => ( { /> ))}
- ) -} + ); +}; -const Loading = () =>
Loading...
+const Loading = () => (
Loading...
) -const ErrorMessage = () =>
There was an error loading your projects.
+const ErrorMessage = () => (
There was an error loading your projects.
) const my = () => { const [projects, setProjects] = useState([]) @@ -44,7 +45,7 @@ const my = () => { const response = await fetch('/api/arcade/showcase/projects/my', { method: 'GET', headers: { - Authorization: `Bearer ${token}` + 'Authorization': `Bearer ${token}` } }).catch(e => { console.error(e) @@ -64,7 +65,11 @@ const my = () => { return (
) } -export default my +export default my \ No newline at end of file diff --git a/pages/arcade/showcase/project/[ID]/index.js b/pages/arcade/showcase/project/[ID]/index.js new file mode 100644 index 00000000..b8aac7d4 --- /dev/null +++ b/pages/arcade/showcase/project/[ID]/index.js @@ -0,0 +1,9 @@ +import React from 'react' + +const Page = () => { + return ( +
Project
+ ) +} + +export default Page \ No newline at end of file diff --git a/public/arcade/plus.png b/public/arcade/plus.png new file mode 100644 index 00000000..f2e2518e Binary files /dev/null and b/public/arcade/plus.png differ