Skip to content

Commit 6329fea

Browse files
committed
funky gallery scroll - gone!
1 parent 2b9c109 commit 6329fea

File tree

2 files changed

+9
-20
lines changed

2 files changed

+9
-20
lines changed

components/slack/project.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export default function Project({ title, description, color, img, itemId }) {
1616
`linear-gradient(to bottom, ${color[0]}, ${color[1]})`,
1717
color: 'white',
1818
overflow: 'clip',
19-
width: ['100vw', '50rem', '70rem'],
19+
width: ['100vw', '40rem', '50rem', '70rem'],
2020
height: ['25rem', '40rem'],
2121
transition: '700ms cubic-bezier(0.075, 0.02, 0.165, 1)',
2222
transformOrigin: 'center',

pages/slack.js

+8-19
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Meta from '@hackclub/meta'
22
import Head from 'next/head'
33
import { Box, Container, Heading, Text } from 'theme-ui'
4-
import { useRef, useState, useEffect, useCallback } from 'react'
4+
import { useRef } from 'react'
55
import { ScrollMenu } from 'react-horizontal-scrolling-menu'
66
import 'react-horizontal-scrolling-menu/dist/styles.css'
77

@@ -83,12 +83,8 @@ const SlackPage = () => {
8383
paddingT: '1rem'
8484
}}
8585
>
86-
<Box>
87-
<ScrollMenu
88-
Footer={Arrows}
89-
onWheel={onWheel}
90-
style={{ scrollbar: 'hidden' }}
91-
>
86+
<Box onMouseEnter={disableScroll} onMouseLeave={enableScroll}>
87+
<ScrollMenu Footer={Arrows} style={{ scrollbar: 'hidden' }}>
9288
{projects.map(project => (
9389
<Project
9490
title={project.title}
@@ -133,19 +129,12 @@ const SlackPage = () => {
133129
)
134130
}
135131

136-
function onWheel(apiObj, ev) {
137-
const isThouchpad = Math.abs(ev.deltaX) !== 0 || Math.abs(ev.deltaY) < 15
138-
139-
if (isThouchpad) {
140-
ev.stopPropagation()
141-
return
142-
}
132+
function disableScroll() {
133+
document.body.style.overflowAnchor = 'hidden'
134+
}
143135

144-
if (ev.deltaY < 0) {
145-
apiObj.scrollNext()
146-
} else if (ev.deltaY > 0) {
147-
apiObj.scrollPrev()
148-
}
136+
function enableScroll() {
137+
document.body.style.overflowAnchor = 'scroll'
149138
}
150139

151140
export default SlackPage

0 commit comments

Comments
 (0)