File size: 3,450 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
import { getDiscordMembers } from "@/lib/get-discord-members"
import { getGithubStars } from "@/lib/get-github-stars"
import { getNpmDownloads } from "@/lib/get-npm-downloads"
import {
  Box,
  Container,
  Flex,
  Heading,
  Icon,
  Span,
  Stack,
  Text,
} from "@chakra-ui/react"
import { BsGithub } from "react-icons/bs"
import { FaDiscord } from "react-icons/fa"
import { IconType } from "react-icons/lib"
import { RiNpmjsFill } from "react-icons/ri"
import { Blob } from "./blob"
import { BlitzIcon } from "./icons"
import { HighlightHeading } from "./typography"

const BlitzIconSection = () => (
  <Icon
    asChild
    w="245px"
    h="342px"
    pos="absolute"
    top="-28"
    right="67px"
    color="fg.inverted"
    hideBelow="md"
  >
    <BlitzIcon />
  </Icon>
)

interface StatBoxProps {
  icon: IconType
  title: string
  description: string
}

const StatsBox = (props: StatBoxProps) => {
  const { icon: StatIcon, title, description } = props

  return (
    <Stack
      flex="1"
      ms="-1px"
      borderWidth="1px"
      borderColor={{ _light: "border", _dark: "#001B18" }}
      align="center"
      gap={{ base: "3", md: "6" }}
      pt={{ base: "5", md: "10" }}
      pb={{ base: "4", md: "8" }}
    >
      <Text
        fontWeight="medium"
        color={{ _light: "teal.600", _dark: "teal.500" }}
        textStyle={{ base: "4xl", md: "7xl" }}
      >
        {description}
      </Text>
      <Flex align="center" gap="3">
        <Icon color={{ _light: "teal.600", _dark: "teal.500" }}>
          <StatIcon />
        </Icon>
        <Text color="fg.muted" fontWeight="medium">
          {title}
        </Text>
      </Flex>
    </Stack>
  )
}

const KeyStats = async () => {
  const [
    { prettyCount: githubStars },
    { prettyCount: npmDownloads },
    { prettyCount: discordMembers },
  ] = await Promise.all([
    getGithubStars(),
    getNpmDownloads(),
    getDiscordMembers(),
  ])

  return (
    <Flex
      w="full"
      maxW="6xl"
      pos="relative"
      direction={{ base: "column", md: "row" }}
    >
      <StatsBox
        icon={RiNpmjsFill}
        title="downloads  / month"
        description={npmDownloads}
      />
      <StatsBox
        icon={BsGithub}
        title="github stars"
        description={githubStars}
      />
      <StatsBox
        icon={FaDiscord}
        title="discord members"
        description={discordMembers}
      />
    </Flex>
  )
}

export const StatSection = async () => {
  return (
    <Box as="section" py="20">
      <Container>
        <Stack
          gap={{ base: "10", md: "20" }}
          pos="relative"
          align="center"
          maxW="100%"
        >
          <BlitzIconSection />
          <Stack gap={{ base: "6", md: "14" }} align="center">
            <HighlightHeading
              query="By developers"
              as="h2"
              maxW="500px"
              textAlign="center"
            >
              Built for developers By developers
            </HighlightHeading>
            <Heading textAlign="center" fontWeight="medium">
              Built for modern product teams.
              <br />
              <Span color="fg.muted">
                From next-gen startups to established enterprises.
              </Span>
            </Heading>
          </Stack>
          <KeyStats />
        </Stack>

        <Blob width="765px" height="765px" right="-32" bottom="-50%" />
      </Container>
    </Box>
  )
}