import {
Box,
BoxProps,
Button,
Center,
Circle,
Divider,
Flex,
Grid,
Heading,
Icon,
LightMode,
Link,
SimpleGrid,
Stack,
Text,
Wrap,
WrapItem,
chakra,
} from '@chakra-ui/react'
import users from 'chakra-users'
import ChakraNextImage from 'components/chakra-next-image'
import { AdBanner } from 'components/chakra-pro/ad-banner'
import { ChakraProAd } from 'components/chakra-pro/home-page-ad'
import Container from 'components/container'
import { DiscordStrip } from 'components/discord-strip'
import { Footer } from 'components/footer'
import Header from 'components/header'
import SandpackEmbed from 'components/sandpack-embed'
import SEO from 'components/seo'
import ShowcaseSection from 'components/showcase/showcase-section'
import TweetCard from 'components/tweet-card'
import { App, Index } from 'configs/sandpack-contents/homepage/files'
import tweets from 'configs/tweets.json'
import NextLink from 'next/link'
import * as React from 'react'
import { AiFillThunderbolt } from 'react-icons/ai'
import { DiGithubBadge } from 'react-icons/di'
import { FaArrowRight, FaDiscord, FaMicrophone } from 'react-icons/fa'
import { FiDownload, FiGithub, FiUsers } from 'react-icons/fi'
import { IoMdMoon } from 'react-icons/io'
import { MdAccessibility, MdGrain, MdPalette } from 'react-icons/md'
import type { Member, Sponsor } from 'src/types/github'
import { getAllContributors } from 'utils/get-all-contributors'
import { getAllMembers } from 'utils/get-all-members'
import { getAllSponsors } from 'utils/get-all-sponsors'
import { getDiscordMembers } from 'utils/get-discord-members'
import { getGithubStars } from 'utils/get-github-stars'
import { getNpmDownloads } from 'utils/get-npm-downloads'
import { t } from 'utils/i18n'
const openCollectiveLink = 'https://opencollective.com/chakra-ui'
const Feature = ({ title, icon, children, ...props }) => {
return (
{title}
{children}
)
}
interface Tweet {
content: string
handle: string
name: string
date: string
image: string
url: string
}
interface StatBoxProps extends BoxProps {
icon?: React.ElementType
title: string
description: string
}
const StatBox = (props: StatBoxProps) => {
const { icon: StatIcon, title, description, ...rest } = props
return (
{title}
{description}
)
}
interface HomePageProps {
members: Member[]
githubStars: string
npmDownloads: string
discordMembers: string
sponsors: {
companies: Sponsor[]
individuals: Sponsor[]
}
}
const HomePage = ({
members,
sponsors,
githubStars,
npmDownloads,
discordMembers,
}: HomePageProps) => {
return (
<>
{t('homepage.title.main')}
{' '}
{t('homepage.title.highlighted')}
{t('homepage.message')}
}
>
{t('homepage.get-started')}
}
>
GitHub
{t('homepage.supported-and-backed-by')}
{users
.filter((user) => user.image.includes('.'))
.slice(0, 7)
.map((user) => (
))}
{t('homepage.less-code-more-speed')}
{t('homepage.less-code-description')}
{t('homepage.feature-section.title')}
{t('homepage.feature-section.description')}
{t('homepage.feature-section.accessible.description')}
{t('homepage.feature-section.themeable.description')}
{t('homepage.feature-section.composable.description')}
{t('homepage.feature-section.light-and-dark-ui.description')}
{t('homepage.feature-section.developer-experience.description')}
{t('homepage.feature-section.active-community.description')}
{t('homepage.growing-section.title')}
{t('homepage.growing-section.description')}
{t('homepage.growing-section.chakra-heroes')}
{members.map((i) => (
))}
{t('homepage.loved-by-product-people-section.title')}
{chunk(tweets.tweets, 3).map((tweetList, idx) => (
{tweetList.map((tweet: Tweet, idx) => (
))}
))}
{t('homepage.support-chakra-ui-section.title')}
{t('homepage.support-chakra-ui-section.description')}
Open Collective
{t(
'homepage.support-chakra-ui-section.sponsor-the-chakra-ui-maintainers',
)}
Patreon
{t(
'homepage.support-chakra-ui-section.sponsor-the-creator',
)}
{t('homepage.support-chakra-ui-section.organization-sponsors')}
{sponsors.companies.map((i) => (
))}
{t('homepage.support-chakra-ui-section.individual-sponsors')}
{sponsors.individuals.map((i) => (
))}
{t('homepage.event-section.title')}
{t('homepage.event-section.description')}
}
>
{t('homepage.event-section.invite-us-to-speak')}
>
)
}
function chunk(array: T[], size: number): T[][] {
return array.reduce((rows: T[][], currentValue: T, index: number) => {
if (index % size === 0) {
rows.push([currentValue])
} else {
rows[rows.length - 1].push(currentValue)
}
return rows
}, [] as T[][])
}
export async function getStaticProps() {
const [
{ prettyCount: githubStars },
{ prettyCount: npmDownloads },
{ prettyCount: discordMembers },
] = await Promise.all([
getGithubStars(),
getNpmDownloads(),
getDiscordMembers(),
])
const contributors = getAllContributors()
const members = getAllMembers()
const sponsors = getAllSponsors()
return {
props: {
githubStars,
members,
contributors,
sponsors,
discordMembers,
npmDownloads,
},
}
}
export default HomePage