File size: 2,024 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
"use client"

import { Flex, Link, Stack, StackProps, Text, chakra } from "@chakra-ui/react"
import NextLink from "next/link"
import type { JSX } from "react"

const Section = ({ children }: { children: React.ReactNode }) => {
  return (
    <Flex direction="column" gap="5" mb={{ base: "5", sm: "8" }}>
      {children}
    </Flex>
  )
}

interface SectionTitleProps {
  children: React.ReactNode
  id: string
}

const SectionTitle = ({ children, id }: SectionTitleProps) => {
  return (
    <Flex
      align="center"
      justify="space-between"
      gap="4"
      mt="2"
      bg="bg.muted"
      px="4"
      py="3"
      rounded="md"
      colorPalette="gray"
      textStyle="sm"
    >
      <Text fontWeight="medium" id={id}>
        <Link href={`#${id}`}>{children}</Link>
      </Text>
      <NextLink passHref legacyBehavior href={`/docs/components/${id}`}>
        <Link fontSize="sm">View in docs</Link>
      </NextLink>
    </Flex>
  )
}

const Table = chakra("table", {
  base: {
    marginBottom: "32px",
    borderCollapse: "collapse",
    "& td:not(.chakra-table__cell)": {
      paddingRight: "8",
      paddingBottom: "8",
    },
    "& th:not(.chakra-table__column-header)": {
      fontSize: "sm",
      color: "fg.muted",
    },
    "& thead td:not(.chakra-table__cell)": {
      fontSize: "sm",
      color: "fg.muted",
    },
  },
})

const SectionContent = (props: StackProps) => {
  return <Stack gap="8" {...props} />
}

interface DemoListProps {
  items: Array<{
    label: string
    component: JSX.Element
    align?: StackProps["align"]
  }>
}

const DemoList = (props: DemoListProps) => {
  const { items } = props
  return (
    <>
      {items.map(({ label, component, align }) => (
        <Stack key={label} align={align || "flex-start"} gap="5">
          <Text color="fg.muted" textStyle="sm" fontWeight="medium">
            {label}
          </Text>
          {component}
        </Stack>
      ))}
    </>
  )
}

export { DemoList, Section, SectionContent, SectionTitle, Table }