File size: 3,208 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 |
import { CollectionIcon } from "@/components/collection-icon"
import { getGuideCollections } from "@/lib/guide"
import {
Badge,
Box,
Card,
Container,
Flex,
HStack,
Heading,
Link,
SimpleGrid,
Skeleton,
Square,
Stack,
Text,
VStack,
} from "@chakra-ui/react"
import { Metadata } from "next"
import NextLink from "next/link"
import { Suspense } from "react"
import { LuChevronRight } from "react-icons/lu"
import { GuideSearchInput } from "./search-input"
export const metadata: Metadata = {
title: "Guides",
description: "Get answers to common questions about Chakra UI v3.0",
openGraph: {
images: `/og?title=Guides`,
},
}
export default function GuidePage() {
const collections = getGuideCollections().sort(
(a, b) => b.guides.length - a.guides.length,
)
return (
<Box flex="1" colorPalette="teal">
<Container maxW="2xl" py="20">
<VStack gap="8">
<VStack textAlign="center">
<Heading as="h1" size={{ base: "4xl", md: "5xl" }}>
How can we help?
</Heading>
<Text color="fg.muted" textStyle="lg">
Find answers to common questions related to Chakra UI v3.0
</Text>
</VStack>
<Box flex="1" alignSelf="stretch">
<Suspense fallback={<Skeleton width="full" height="12" />}>
<GuideSearchInput />
</Suspense>
</Box>
</VStack>
</Container>
<Container pt="8" pb="16">
<Stack gap="8">
{collections.map((collection) => (
<Card.Root variant="elevated" key={collection.id}>
<Card.Header gap="1">
<Flex gap="3">
<Square size="10" layerStyle="fill.solid" rounded="l2">
<CollectionIcon value={collection.id} />
</Square>
<Stack gap="0" mt="-1">
<HStack>
<Card.Title>{collection.title}</Card.Title>
<Badge size="sm" variant="subtle" colorPalette="gray">
{collection.guides.length} articles
</Badge>
</HStack>
<Text color="fg.muted" textStyle="sm" minH="2lh">
{collection.description}
</Text>
</Stack>
</Flex>
</Card.Header>
<Card.Body gap="1">
<SimpleGrid columns={{ base: 1, md: 3 }} gap="4">
{collection.guides.map((guide, index) => (
<Link
borderWidth="1px"
key={`${guide.collection}-${index}`}
textStyle="sm"
padding="4"
rounded="md"
asChild
>
<NextLink href={guide.slug}>
{guide.title} <LuChevronRight />
</NextLink>
</Link>
))}
</SimpleGrid>
</Card.Body>
</Card.Root>
))}
</Stack>
</Container>
</Box>
)
}
|