From 735b4a3d7b15b4f127b9c70d8ae3f057d81226ce Mon Sep 17 00:00:00 2001 From: Toby Brown Date: Sat, 20 Jan 2024 15:09:58 +0000 Subject: [PATCH] sorta works! --- components/slack/arrows.js | 23 +++++++++- components/slack/project.js | 6 ++- components/slack/projects.js | 14 ++++--- pages/slack.js | 81 ++++++++++++++++++++---------------- 4 files changed, 79 insertions(+), 45 deletions(-) diff --git a/components/slack/arrows.js b/components/slack/arrows.js index 2c6774af..2b8c329d 100644 --- a/components/slack/arrows.js +++ b/components/slack/arrows.js @@ -1,7 +1,26 @@ +import { VisibilityContext } from 'react-horizontal-scrolling-menu' +import { useContext } from 'react' + export function LeftArrow() { - return + const { scrollPrev } = useContext(VisibilityContext) + return } export function RightArrow() { - return + const { scrollNext } = useContext(VisibilityContext) + return +} + +export default function Arrows() { + return ( +
+
+ +
+
+ ) } diff --git a/components/slack/project.js b/components/slack/project.js index e44e9b1d..84c0d8d1 100644 --- a/components/slack/project.js +++ b/components/slack/project.js @@ -8,11 +8,14 @@ export default function Project({ sx, color, img, - itemId + itemId, + width }) { const visible = useContext(VisibilityContext) const isVisible = visible.isItemVisible(itemId) + console.log(itemId) + return ( { const nameInputRef = useRef(null) @@ -34,6 +35,10 @@ const SlackPage = () => { } } + const [containerWidth, setContainerWidth] = useState(0) + const containerRef = useRef() + const itemWidth = containerWidth / 2 || 160 + return ( <> { Everything here was built by Hack Clubbers. - - - {projects.map((project, index) => ( - - ))} - - + + {projects.map((project, index, id) => ( + + ))} + { ) } +function onWheel(apiObj, ev) { + const isThouchpad = Math.abs(ev.deltaX) !== 0 || Math.abs(ev.deltaY) < 15 + + if (isThouchpad) { + ev.stopPropagation() + return + } + + if (ev.deltaY < 0) { + apiObj.scrollNext() + } else if (ev.deltaY > 0) { + apiObj.scrollPrev() + } +} + export default SlackPage