diff --git a/components/index/rotating-project.js b/components/index/rotating-project.js new file mode 100644 index 000000000..fcdf0186d --- /dev/null +++ b/components/index/rotating-project.js @@ -0,0 +1,199 @@ +import { + Box, + Card, + Heading, + Text, + Image, + Button, + Flex, + Badge, + Link +} from 'theme-ui' +import Icon from '../icon' +import { useState, useEffect } from 'react' + +const RotatingProject = ({ project }) => { + const [views, setViews] = useState(null) + const [showBackstory, setShowBackstory] = useState(false) + + useEffect(() => { + fetch('/api/project-views', { method: 'POST' }) + .then(r => r.json()) + .then(data => setViews(data.views)) + }, []) + + if (!project) return null + return ( + + + + Project of the Week + + + + + + + {showBackstory ? ( + + + The Story + + + {project.backstory} + + + + ) : ( + <> + + {project.title} + + + + {project.title} + + + + by {project.author} + {views && ( + <> + {' '} + • {views} view{views === 12345 ? '' : 's'} + + )} + + + + {project.description} + + + + {project.backstory && ( + + )} + + + + )} + + ) +} + +export default RotatingProject diff --git a/lib/rotating-projects-data.js b/lib/rotating-projects-data.js new file mode 100644 index 000000000..fbd8179c7 --- /dev/null +++ b/lib/rotating-projects-data.js @@ -0,0 +1,15 @@ +const featuredProject = { + title: 'Hydra', + description: 'A Nintendo Switch emulator for macOS', + backstory: + 'Hydra is an in-development Nintendo Switch emulator for macOS. It was built by SamoZ256, a Hack Clubber, to explore the lorem ipsum dolor sit amet.', + image: + 'https://raw.githubusercontent.com/SamoZ256/hydra/main/img/showcase.png', + demoLink: 'https://github.com/SamoZ256/hydra', + githubLink: 'https://github.com/SamoZ256/hydra', + author: 'SamoZ256', + layerUp: true, + imageScale: 1.2 +} + +export default featuredProject diff --git a/pages/api/project-views.js b/pages/api/project-views.js new file mode 100644 index 000000000..c40a771c6 --- /dev/null +++ b/pages/api/project-views.js @@ -0,0 +1,8 @@ +let views = 0 + +export default function handler(req, res) { + if (req.method === 'POST') { + views++ + } + res.status(200).json({ views }) +} diff --git a/pages/index.js b/pages/index.js index 64a9769c4..f50c84abd 100644 --- a/pages/index.js +++ b/pages/index.js @@ -48,6 +48,8 @@ import Aces from '../components/index/cards/aces' import Highway from '../components/index/cards/highway' import Shipwrecked from '../components/index/cards/shipwrecked' import CTAS from '../components/index/ctas' +import RotatingProject from '../components/index/rotating-project' +import featuredProject from '../lib/rotating-projects-data' /** @jsxImportSource theme-ui */ function Page({ @@ -212,7 +214,7 @@ function Page({ as="header" sx={{ bg: 'dark', - pt: [5, 6], + pt: [4, 5], pb: [2, 3], textAlign: 'left', position: 'relative', @@ -225,7 +227,7 @@ function Page({ priority gradient="linear-gradient(rgba(0,0,0,0.4), rgba(0,0,0,0.45))" /> - {announcementVariant === 'blueprint' ? ( + {/* {announcementVariant === 'blueprint' ? ( - )} + )} */} - - We are {slackData.total_members_count}{' '} - + { - !reveal ? setReveal(true) : setReveal(false) - }} + as="p" + variant="title" sx={{ - // lineHeight: 0.875, - px: 2, - backgroundColor: 'red', - position: 'absolute', - borderRadius: 10, - transform: 'rotate(-3deg) translateY(-5px)', color: 'white', - whiteSpace: 'nowrap', - textDecoration: 'none', - '&:hover': { - cursor: 'pointer' - } + mb: [3, 4], + zIndex: 1, + textAlign: 'left', + fontSize: ['42px', '52px', '64px'], + lineHeight: 1.2, + width: '100%' }} - aria-hidden="true" > - teen hackers - - teen hackers - -
from around - the world who code together -
- - {/* {ctaVariant === 'blueprint' ? ( - - ) : ( - <> +
from + around the world who code together + + + {/* {ctaVariant === 'blueprint' ? ( + + ) : ( + <> + + + + )} */} + - RSVP for Moonshot! - - - - )} */} - - - Or, check out our programs: - - + Or, check out our programs: + +
+
+ + + +