mirror of
https://github.com/System-End/site.git
synced 2026-04-19 18:35:12 +00:00
we're takin' shape!
This commit is contained in:
parent
2aa4e44d91
commit
feb25dfe8e
4 changed files with 77 additions and 5 deletions
|
|
@ -1,21 +1,58 @@
|
||||||
import { VisibilityContext } from 'react-horizontal-scrolling-menu'
|
import { VisibilityContext } from 'react-horizontal-scrolling-menu'
|
||||||
import { useContext } from 'react'
|
import { useContext } from 'react'
|
||||||
|
import Icon from '@hackclub/icons'
|
||||||
|
import { Link } from 'theme-ui'
|
||||||
|
|
||||||
export function LeftArrow() {
|
export function LeftArrow() {
|
||||||
const { scrollPrev } = useContext(VisibilityContext)
|
const { scrollPrev } = useContext(VisibilityContext)
|
||||||
return <button onClick={() => scrollPrev()}>Left</button>
|
return (
|
||||||
|
<Link
|
||||||
|
onClick={() => scrollPrev()}
|
||||||
|
sx={{
|
||||||
|
borderRadius: 100,
|
||||||
|
boxShadow: 'none',
|
||||||
|
backgroundColor: 'black',
|
||||||
|
padding: '8px',
|
||||||
|
cursor: 'pointer',
|
||||||
|
placeItems: 'center',
|
||||||
|
display: 'flex',
|
||||||
|
mr: 2
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Icon glyph="view-back" size={32} color="white" />
|
||||||
|
</Link>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function RightArrow() {
|
export function RightArrow() {
|
||||||
const { scrollNext } = useContext(VisibilityContext)
|
const { scrollNext } = useContext(VisibilityContext)
|
||||||
return <button onClick={() => scrollNext()}>Right</button>
|
return (
|
||||||
|
<Link
|
||||||
|
onClick={() => scrollNext()}
|
||||||
|
sx={{
|
||||||
|
borderRadius: 100,
|
||||||
|
boxShadow: 'none',
|
||||||
|
backgroundColor: 'black',
|
||||||
|
padding: '8px',
|
||||||
|
cursor: 'pointer',
|
||||||
|
placeItems: 'center',
|
||||||
|
display: 'flex'
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Icon glyph="view-forward" size={32} color="white" />
|
||||||
|
</Link>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function Arrows() {
|
export default function Arrows() {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
display: 'flex'
|
display: 'flex',
|
||||||
|
marginTop: 32,
|
||||||
|
marginBottom: 32,
|
||||||
|
position: 'relative',
|
||||||
|
left: 'calc(26vw + 63rem)'
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div style={{ display: 'flex' }}>
|
<div style={{ display: 'flex' }}>
|
||||||
|
|
|
||||||
32
components/slack/preventScroll.js
Normal file
32
components/slack/preventScroll.js
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
import { useCallback, useEffect, useState } from 'react'
|
||||||
|
|
||||||
|
const preventDefault = ev => {
|
||||||
|
if (ev.preventDefault) {
|
||||||
|
ev.preventDefault()
|
||||||
|
}
|
||||||
|
ev.returnValue = false
|
||||||
|
}
|
||||||
|
|
||||||
|
const enableBodyScroll = () => {
|
||||||
|
document && document.removeEventListener('wheel', preventDefault, false)
|
||||||
|
}
|
||||||
|
const disableBodyScroll = () => {
|
||||||
|
document &&
|
||||||
|
document.addEventListener('wheel', preventDefault, {
|
||||||
|
passive: false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function usePreventScroll() {
|
||||||
|
const [hidden, setHidden] = useState(false)
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
hidden ? disableBodyScroll() : enableBodyScroll()
|
||||||
|
|
||||||
|
return enableBodyScroll
|
||||||
|
}, [hidden])
|
||||||
|
|
||||||
|
const disableScroll = useCallback(() => setHidden(true), [])
|
||||||
|
const enableScroll = useCallback(() => setHidden(false), [])
|
||||||
|
return { disableScroll, enableScroll }
|
||||||
|
}
|
||||||
|
|
@ -22,7 +22,6 @@ export default function Project({ title, description, color, img, itemId }) {
|
||||||
height: '100%',
|
height: '100%',
|
||||||
transition: '700ms cubic-bezier(0.075, 0.02, 0.165, 1)',
|
transition: '700ms cubic-bezier(0.075, 0.02, 0.165, 1)',
|
||||||
transformOrigin: 'center',
|
transformOrigin: 'center',
|
||||||
opacity: isVisible ? 1 : 0.25,
|
|
||||||
mx: 16,
|
mx: 16,
|
||||||
ml: `${itemId === 0 ? '26vw' : '0'}`
|
ml: `${itemId === 0 ? '26vw' : '0'}`
|
||||||
}}
|
}}
|
||||||
|
|
|
||||||
|
|
@ -16,9 +16,11 @@ import Header from '../components/slack/header'
|
||||||
import Project from '../components/slack/project'
|
import Project from '../components/slack/project'
|
||||||
import Quote from '../components/slack/quote'
|
import Quote from '../components/slack/quote'
|
||||||
import Arrows from '../components/slack/arrows'
|
import Arrows from '../components/slack/arrows'
|
||||||
|
import usePreventScroll from '../components/slack/preventScroll'
|
||||||
|
|
||||||
const SlackPage = () => {
|
const SlackPage = () => {
|
||||||
const nameInputRef = useRef(null)
|
const nameInputRef = useRef(null)
|
||||||
|
const { disableScroll, enableScroll } = usePreventScroll()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|
@ -80,8 +82,10 @@ const SlackPage = () => {
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
backgroundColor: '#F9FAFC',
|
backgroundColor: '#F9FAFC',
|
||||||
paddingY: '1rem'
|
paddingT: '1rem'
|
||||||
}}
|
}}
|
||||||
|
onMouseEnter={disableScroll}
|
||||||
|
onMouseLeave={enableScroll}
|
||||||
>
|
>
|
||||||
<ScrollMenu Footer={Arrows} onWheel={onWheel}>
|
<ScrollMenu Footer={Arrows} onWheel={onWheel}>
|
||||||
{projects.map(project => (
|
{projects.map(project => (
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue