site/components/slack.js
2022-04-08 11:28:36 +08:00

147 lines
4 KiB
JavaScript

import { Button, Box, Container, Heading, Flex, Grid, Text } from 'theme-ui'
import styled from '@emotion/styled'
import usePrefersMotion from '../lib/use-prefers-motion'
import useHasMounted from '../lib/use-has-mounted'
import { formatted } from '../lib/members'
let Highlight = styled(Text)`
color: inherit;
border-radius: 1em 0 1em 0;
background: linear-gradient(
-100deg,
rgba(250, 247, 133, 0.33),
rgba(250, 247, 133, 0.66) 95%,
rgba(250, 247, 133, 0.1)
);
`
Highlight = Highlight.withComponent('mark')
const Content = () => (
<Container
sx={{
textAlign: 'center',
zIndex: 999,
py: 6,
color: 'white',
'h2,p': { textShadow: 'text' },
textAlign: [null, 'center'],
position: 'relative',
overflow: 'hidden'
}}
>
<Text as="p" variant="eyebrow" sx={{ color: 'white', opacity: 0.75 }}>
~ The Hack Club Slack ~
</Text>
<Heading as="h2" variant="title">
Come for the skills, <br /> stay for the people.
</Heading>
<Text as="p" variant="lead" sx={{ maxWidth: 'copyPlus', mx: 'auto' }}>
Coding is often seen as an isolating activity. Plenty of groups exist for
kids who are interested in sports, theater, or chess, but the stereotype
of a programmer is a person who sits alone in a dark room.{' '}
<strong>It doesn't have to be this way</strong>—in the Hack Club Slack
(Discord-style online groupchat), you'll find a group of {formatted}+{' '}
<Highlight>fabulous people</Highlight> to talk to, active at all hours.
For leaders, you'll be able to connect with other leaders and support one
another.
</Text>
<Button
as="a"
href="https://hackclub.com/slack/"
variant="ctaLg"
sx={{
background: 'linear-gradient(-132deg, #338eda 14%, #33d6a6 82%)'
}}
>
Join our Slack →
</Button>
</Container>
)
const Cover = () => (
<Box
sx={{
position: 'absolute',
bottom: 0,
top: 0,
left: 0,
right: 0,
backgroundImage: t => t.util.gx('cyan', 'purple'),
opacity: 0.825,
zIndex: 1
}}
/>
)
const Static = ({
img = 'https://cloud-nykwtt0z7.vercel.app/2020-07-25_a1tcva4ch6mmr6j2cfmcb4e9ync3yhar.png'
// img="https://cloud-re5hkabx0.vercel.app/2020-07-25_hn13qhejqrzu4n1jy9yacxxgrgp3wf5u.png"
}) => (
<Box
as="section"
id="slack"
sx={{
position: 'relative',
overflow: 'hidden',
backgroundImage: `url(${img})`,
backgroundSize: 'cover'
}}
>
<Cover />
<Content />
</Box>
)
const Slack = () => {
const hasMounted = useHasMounted()
const prefersMotion = usePrefersMotion()
if (hasMounted && prefersMotion) {
return (
<Box
as="section"
id="slack"
sx={{ overflow: 'hidden', position: 'relative' }}
>
<Box
as="video"
autoPlay
muted
loop
playsInline
poster="https://cloud-nykwtt0z7.vercel.app/2020-07-25_a1tcva4ch6mmr6j2cfmcb4e9ync3yhar.png"
duration={2000}
sx={{
position: 'absolute',
bottom: 0,
top: 0,
left: 0,
right: 0,
height: '100%',
zIndex: -1,
width: '100vw',
objectFit: 'cover'
}}
>
<source
src="https://cdn.glitch.com/2d637c98-ed35-417a-bf89-cecc165d7398%2Foutput-no-duplicate-frames.hecv.mp4?v=1590780967658"
type="video/mp4; codecs=hevc"
/>
<source
src="https://cdn.glitch.com/2d637c98-ed35-417a-bf89-cecc165d7398%2Foutput-no-duplicate-frames.webm?v=1590781698834"
type="video/webm; codecs=vp9,opus"
/>
<source
src="https://cdn.glitch.com/2d637c98-ed35-417a-bf89-cecc165d7398%2Foutput-no-duplicate-frames.mov?v=1590781491717"
type="video/quicktime"
/>
</Box>
<Cover />
<Content />
</Box>
)
} else {
return <Static />
}
}
export default Slack