Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 27 additions & 2 deletions components/index/cards/card-model.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Box, Card, Flex, Image, Link, Text } from 'theme-ui'
import { Zoom } from 'react-reveal'
import ReactTooltip from '../../react-tooltip'
import Comma from '../../comma'
import CountUp from 'react-countup'

/** @jsxImportSource theme-ui */

Expand Down Expand Up @@ -95,7 +96,19 @@ const CardModel = ({
</Link>
{stars ? (
<Text as="h2">
⭐️ <Comma>{stars}</Comma>
⭐️ <CountUp
start={0}
end={stars}
delay={0}
duration={2.5}
separator=","
scrollSpyOnce={true}
enableScrollSpy={true}
>
{({countUpRef}) => (
<span ref={countUpRef} className="cursor-pointer"></span>
)}
</CountUp>
</Text>
) : (
<></>
Expand All @@ -114,7 +127,19 @@ const CardModel = ({
>
{stars ? (
<Text as="h2" sx={{ fontSize: ['20px', '24px', '28px'] }}>
⭐️ <Comma>{stars}</Comma>
⭐️ <CountUp
start={0}
end={stars}
delay={0}
duration={2.5}
separator=","
scrollSpyOnce={true}
enableScrollSpy={true}
>
{({countUpRef}) => (
<span ref={countUpRef} className="cursor-pointer"></span>
)}
</CountUp>
</Text>
) : (
<></>
Expand Down
14 changes: 13 additions & 1 deletion components/index/cards/slack.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import Buttons from './button'
import Event from '../events'
import Dot from '../../dot'
import Comma from '../../comma'
import CountUp from 'react-countup'
/** @jsxImportSource theme-ui */

const Cover = () => (
Expand All @@ -28,7 +29,18 @@ const Stats = ({ data, subheading, nonMobile = false }) => (
as="h4"
sx={{ mb: 0, pt: 2, fontSize: ['28px', '36px', '38px'] }}
>
<Comma>{data}</Comma>
<CountUp
start={0}
scrollSpyOnce={true}
enableScrollSpy={true}
end={data}
duration={2.5}
separator=","
>
{({countUpRef}) => (
<span ref={countUpRef} className="cursor-pointer"></span>
)}
</CountUp>
</Heading>
<Text
sx={{
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
"react-beautiful-dnd": "^13.1.1",
"react-before-after-slider-component": "^1.1.8",
"react-countdown": "^2.3.6",
"react-countup": "^6.5.3",
"react-datepicker": "^4.24.0",
"react-dom": "^17.0.2",
"react-horizontal-scrolling-menu": "^6.0.2",
Expand Down
24 changes: 20 additions & 4 deletions pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import Onboard from '../components/index/cards/onboard'
import Trail from '../components/index/cards/trail'
import HighSeas from '../components/index/cards/highseas'
import Counterspell from '../components/index/cards/counterspell'
import CountUp from 'react-countup'
/** @jsxImportSource theme-ui */

function Page({
Expand Down Expand Up @@ -246,7 +247,22 @@ function Page({
width: '100%'
}}
>
We are <Comma>{slackData.total_members_count}</Comma>{' '}
We are{' '}
{slackData.total_members_count && (
<CountUp
start={0}
end={slackData.total_members_count}
delay={0}
duration={2.5}
separator=","
scrollSpyOnce={true}
enableScrollSpy={true}
>
{({countUpRef}) => (
<span ref={countUpRef} className="cursor-pointer"></span>
)}
</CountUp>
)}
<Text
sx={{
color: 'transparent',
Expand Down Expand Up @@ -1279,9 +1295,9 @@ export async function getStaticProps() {

let events = []
try {
await fetch(
'https://events.hackclub.com/api/events/upcoming/'
).then(res => res.json())
await fetch('https://events.hackclub.com/api/events/upcoming/').then(res =>
res.json()
)
} catch (error) {
console.error('Error fetching events:', error)
}
Expand Down
Loading